ADM Device could not be created because of "incompatible JDK" - java

Android Device Manager prevents me from creating an Android Device because of an incompatible JDK. However, maui-check shows me that i've got OpenJDK 11.0 installed.
Image of error message and maui-check.
Image of device I'm trying to create.
I've tried the "Install and configure Microsoft Mobile OpenJDK" but going through that it just shows me that everything is installed correctly.
Image of JDK install confirmation.
What exactly am I missing here, do I have to install a previous version of the JDK?

Download OpenJDK 8.0.41 from here
Unzipped files in Program Files > JDK > OpenJDK_8.0.41
Update JDK location in Visual Studio 2022, go to Tools > Xamarin > set above folder path in Java Development Kit Location
Original solution

Related

JAVA_HOME is set to an invalid directory Android Studio (Flutter)

I am using OSX Yosemite on my old mac. When I installed emulator and try to create a run a Flutter project, I started getting an error about JDK 17. I deleted JDK 17 and installed JDK and also set my path in bash profile to "Library/Java/JavaVirtualMachines/jdk-1.8.0_321.jdk/Contents/Home". However, my Android studio is still giving this error.
ERROR: JAVA_HOME is set to an invalid directory: /Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Exception: Gradle task assembleDebug failed with exit code 1
I spent hours solving this. Please help me. Thank you very much.
For Windows:
The problem is because of trace of old Android Studio java folder, just delete this folder and it starts working:
C:\Program Files\Android\Android Studio\jre
The new Android Studio Electric Eel is using jbr, not jre.
For macOS:
If you are using macOS replace the path in .bash_profile or .zshrc
export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home"
with
export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
I resolved the issue. Problem was due to 2 versions of Android Studio installed on same device. One was in applications folder and other was in Downloads folder. I was using Android Studio in Downloads folder and it's installation files are referring to old JDK plugin that was set for another Android Studio because both have similar paths.
/Applications/AndroidStudio.app/Contents/plugins/java/lib/jdkAnnotations.jar
After deleting old Android Studio and moving other one into Application folder resolved my issue. Thanks everybody for helping me out.

Android Device Monitor is not opening in Mac

I need to view and edit the shared preferences for my app. When I try to open the Android Device Monitor from my Android Studios (Tools > Android > Android Device Monitor) it gives the following error:
When I open that log file, the given error is as follows:
https://drive.google.com/file/d/0B43t-lgy1BmXWjMtTjE3ZGI5TlE/view?usp=sharing
I found a similar post where the suggested fix was to update the Java SDK. However my Java SDK is already updated:
I also thought maybe the device monitor was not installed, but it is.
What is going on and how do I get my ADM back?
I had the same problem, that is Android Monitor could't find Java8. Installing with brew didn't help, but installing from Oracle dmg solved the issue.
I had the same problem, following solution worked for me I hope it also helps you, =>
uninstalling the JDK and then again downloaded the JDK 8 from Oracle.
install JDK 8 according to instruction.
To make sure JDK is installed successfully write following command in terminal: /usr/libexec/java_home -v 1.7
then set a path of JDK in Android Studio by doing the following
Go to file -> project Structure -> JDK path.

Android Device Monitor

When trying to access android device monitor on android studio, and I keep getting the error message
Even though I added the new JDK to my project I still keep getting this.
Here's what you can do:
1) Set your Java Path
JAVA_HOME => C:\Program Files\Java\jdk1.7.0_21
path => C:\Program Files\Java\jdk1.7.0_21\bin
2) Check if your Jre path is correct
To Check:
Go to File > Project Structure > SDK Location:
enter image description here
3) There're 2 exe file in android-studio\bin one for 32-bit (studio.exe) and other for 64-bit (studio64.exe). Make sure you're opening the executable file which matches your Java Version.
If above methods doesn't work, then you can:
4) Try to reinstall JDK and JRE again
5) Try to reinstall the Studio again
Right click on android studio icon and choose run as administrator. This will probably solve the issue.

Android Studio only recognising 1.6 JDK when 1.8 installed?

I am learning to build an Android app for the first time, and not even able to get past the set up stage!!
I am using a Mac on OS X 10.9.5. I have the latest version of Android Studio (2.1.2) and JDK/JRE 1.6 and 1.8 installed on my machine.
When I go to Android Studio > About Android Studio, it tells me the JRE is 1.6.
I'm also getting an error saying: "Rendering Problems Android N requires the IDE to be running with Java 1.8 or later Install a supported JDK"
I have JDK v1.8 installed.
In File > Project Structure > SDK Manager I have the following set:
Android SDK Location =
/Users/Tom/Library/Android/sdk
Android JDK Location =
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
When I enter
echo $JAVA_HOME
it displays the following:
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
When I enter
echo $JDK_HOME
it also displays the following:
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
Why is Android Studio not recognising the 1.8 JDK?? Have been googling for 3hrs and getting nowhere. Any advice hugely recommended.
Just move your default Android Studio JRE, in this case to move JDK 1.6.0, on OSX do this
sudo mv /Library/Java/JavaVirtualMachines/1.6.0.jdk /tmp
Then restart your Android Studio, and check "About Android Studio"

Android Studio says JDK 7 isn't Installed, while JDK 8 is even installed

When I try to compile in Android Studio, the program says that sdkVersion 21 requires compiling with JDK is required. Although I installed JDK 7 (and later 8) and my terminal says that they were installed, only the 1.6.0.blabla version is visible as an installed Java Virtual Machine in my folders... How can I fix this?
Note that I am on Windows, so pathname format would be different, but rest of the steps should work fine.
In Android Studio, go to: File > Project Structure > SDK Location and make sure that the JDK Location property has valid path pointing to JDK installed on your system.
On Windows, that property value is "C:\Program Files\Java\jdk1.7.0_55", so you can make a good guess as to what it should be on MacOS.

Categories

Resources