Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio shows an error when trying to use Embedded JDK instead of a custom install

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:

Screenshot showing the embedded JDK being enabled

like image 667
Zoe stands with Ukraine Avatar asked Apr 11 '17 20:04

Zoe stands with Ukraine


People also ask

Should I use embedded JDK Android Studio?

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.

Which version of JDK is compatible with Android Studio?

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.

Can I use JDK 17 with Android Studio?

2 Answers. Save this answer. Show activity on this post. As per the docs, JDK 17 isn't supported yet in Android Studio.

Is JRE required for 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.


1 Answers

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.

like image 166
parik dhakan Avatar answered Oct 02 '22 15:10

parik dhakan