We help IT Professionals succeed at work.

How a correct setup of Android Studio plus Java environment should be made?

Sam Elfassy
Sam Elfassy asked
Last Modified: 2018-12-14
I'm getting software conflict errors such as Gradle could not find the path to the JDK.
After much research and trial & error experiments I've gained more knowledge but still didn't get a straight solution to how that setup should be done correctly.

I've tried several software/settings combinations, hacks and answers I found on Stack Exchange and such sites. But then other issues pop up (and a Gradle scan shows more of them) and what is needed is the correct explanation of how that should be done to build a robust environment the way it was meant to be by the developers.

Android Developer site, the official site from which to download Android Studio, doen't state there's a need for additional JDK/JRE installation, and I also found within Studio a differed version than the latest and no JDK (which is the one that, as I understand, Studio actually needs).
C:\Program Files\Android\Android Studio\jre

I'm using the latest versions on a Windows 8.1 on a Lenovo Y50-70 (64 bit, 16GB RAM):
Android Studio 3.1.2
Gradle 4.4 through Gradle plugin 3.1.2
JDK 10.0.2 (Oracle states it includes the JRE).

I've already installed and uninstalled a couple of times and wouldn't like to further mess up anything (OS registry etc.), what's needed is an experienced expert on-point advise.

Thanks in advance.
Watch Question

Top Expert 2016
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
Sam ElfassyFreelancer


Thank you! That seems to be the exact right solution. Please excuse my 'noobity', unfortunately I still need and would appreciate a few details, if possible. How is that done (it doesn't seem to be an automatic default for many developers)? Which script is that? Did you have to modify it? And if yes then how? Does a separate installation of the JDK is certainly needed in addition to the Studio one?
Top Expert 2016

Which script is that?
It's a bash script i wrote myself. You could get away with setting both those environment as global ones in Windows
Does a separate installation of the JDK is certainly needed in addition to the Studio one?
tbh, i don't know but i just installed one anyway so i'd have the latest
Sam ElfassyFreelancer


Thanks CEHJ.
I've added  JAVA_HOME="C:\Program Files\Java\jdk-10.0.2\bin"  to the path and it solved that issue. Now to the rest of them.
Have a great day.
Top Expert 2016

JAVA_HOME="C:\Program Files\Java\jdk-10.0.2"

Open in new window

PATH="C:\Program Files\Java\jdk-10.0.2\bin";<rest of PATH here>

Open in new window

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions