Avatar of Sam Elfassy
Sam Elfassy
 asked on

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

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.

Avatar of undefined
Last Comment

8/22/2022 - Mon

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Sam Elfassy

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?

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 Elfassy

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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy

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