After I updated to Android Studio 2.3, I haven't been able to use the embedded JDK. When I try to build the project, I get errors like this:
Error:The newly created daemon process has a different context than expected.
Java home is different.
Expecting: 'D:\Development\IDE\AndroidStudio\jre' but was: 'C:\Program Files\Java\jre1.8.0_121'.
Please configure the JDK to match the expected one.
<a href="open.project.structure">Open JDK Settings</a>
But the JAVA_HOME
environment variable isn't defined, but I can still use the normal JDK any problems, so I don't believe that's a problem. Where does Android Studio find the JAVA_HOME
that prevents me from using the embedded JDK?
I tried uninstalled the system JDK to get it to work, and I updated java, which lead to it pointing to the JRE. I then reinstalled the JDK and when I point to it, it works fine. But I want to use the embedded JDK. Any ideas?
I have tried setting JAVA_HOME
in gradle.properties, as linked in comments, but it still shows the error.
The line I added was:
org.gradle.java.home=D:/Development/IDE/AndroidStudio/jre
It should make the embedded JDK work (and change JAVA_HOME
in the IDE) but it doesn't. It still leads to the same error mentioned at the top of this post.
In the snippet it says jre, and that was because when I copied it, I had just uninstalled the JDK. Updating the JDK and Java resulted in JAVA_HOME
being set to the JDK location, but it isn't defined as an environment variable. I tried deleting the JDK table in Android Studio's config folder, but it did not work.
And what it looks when I set the JDK to be the embedded:
A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects.
Note: When developing apps for Android, using Java 8 language features is optional. You can keep your project's source and target compatibility values set to Java 7, but you still need to compile using JDK 8.
2 Answers. Save this answer. Show activity on this post. As per the docs, JDK 17 isn't supported yet in Android Studio.
Android Studio is a customized version of JetBrains' IntelliJ IDE, which is, in turn, a Java application. Therefore, as we established, to launch IntelliJ (and, consequently, Android Studio) on your computer, you need to have JRE installed.
Try to reset your path of your updated JDK. and check it again. May be it will help you. Also clear your android studio temp cache and all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With