Android Device Monitor - java

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.

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.

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

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

I am getting error improperly specified VM option on Android IDE

I just installed new version of Android IDE today on my
D:\program file\Android
and installed java 1.5.0_6 JDK on C drive. I pointed out this path in a system environment
JAVA_HOME C:\Program Files\Java\jdk1.5.0_06\ ( user veriable)
JAVA_HOME C:\Program Files\Java\jdk1.5.0_06\jre\bin\javaw.exe ( system veriable)
after that image getting an error please check this image..
If you added some custom vmoptions then you can simply edit them with proper versions or better delete them.
go to
C:\Users\%USERNAME%\AppData\Roaming\Google\AndroidStudiox.x
and spot the file named
studio64.exe.vmoptions
If you know how to edit it correctly which depends on the version of Android Studio, JDK and other aspects then edit it, in my case I just deleted it.
Restart your Android Studio.
I was using old JDK. so that i was getting error. so use JDK-1.8.* for fix this problem. In my case i tried many versions then i got success 1.8.

Android Device Monitor not found JDK Path

I'm using Arch Linux with Gnome.
I open Android Studio by the desktop item. The code editor works fine, the device manager starts correctly and the app run like a charm, but when I try to open the Device Monitor, I get this error:
A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Monitor. No Java virtual machine
was found after searching the following locations:
/home/grams/Android/Sdk/tools/lib/monitor-x86_64/jre/bin/java
java in your current PATH
When i run the android studion from command line, the Device Monitor works.
Here is the .desktop content
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=/home/grams/android-studio/bin/studio.png
Name[en_US]=Android Studio
Exec=/home/grams/android-studio/bin/studio.sh
Comment[en_US]=Android Studio IDE
Name=Android Studio
Comment=Android Studio IDE
Icon=/home/grams/android-studio/bin/studio.png
My JRE and JDK variables are being added on /etc/profile.
When i run Android Studio on the command line, this error not occurs. Maybe it is a problem with Gnome launcher ?
Newest Android Studio Bundle comes with its own JRE (under <ANDROID_STUDIO>/jre and this is the recommended JRE to work with (look at File / Project Structure / SDK Location).
Likewise, a simple option is to create a symbolic link under the monitor tools to keep JRE in line with Android Studio even getting an update.
For MAC or Linux:
#ln -s <ANDROID_STUDIO>/jre <SDK>/tools/lib/monitor-x86_64/jre
32 bits:
#ln -s <ANDROID_STUDIO>/jre <SDK>/tools/lib/monitor-x86/jre
Then the ddms monitor works for both ways: from Studio IDE (Tools / Android / ADM) or command line (<SDK>tools/./monitor)
Define your environment variables in the initialization file for your login shell: most likely .profile or .bash_profile, depending on your setup. Something like:
export JAVA_HOME="/usr/lib/jdk1.8.0_05"
export PATH=$PATH:$JAVA_HOME
Read more at: where should i manually install JDK8? and JDK installation on Archlinux
Please add the location of the folder containing javaw.exe to the System PATH Environment Variable:
e.g PATH = "C:\Program Files\Java\jdk1.8.0_112\bin"
Make Sure that the variables deceleration naming convention is according to the rules, and the Android Studio is searching by the names, that are predefined.
As in Windows, the Variable that contains JDK path should named: JAVA_HOME
Explore the rules.

Can't Install Android Development Toolkit: Says Missing JDK

I went to the Oracle site, downloaded and installed Java Platform (JDK) 7 on a Windows 7 64 bit virtual machine. I added the path to the c:\program files\Java\jdk1.7.0\bin to the path environment variable. I even deleted c:\windows\system32\Java.exe as recommended by someone. I was essentially following this: "Android Create" call fails in windows 7 - missing JDK
When I install the ADT it gives me the error JDK could not be found. Download the latest JDK. Why?
Thanks.
this is caused because the Android DK finds java in the c:\windows\system32\ folder before it finds the JDK one.
To resolve this edit your PATH environment variable and put the JDK path before the c:\windows\system32\ path.
Just in the ADT installer , press back when the installer promite for No JDK Found then press next, the installer will find the JDK, for sure this is a common bug
Does that happen when you open eclipse?
I'm thinking in two possible problems. Here is one possible solution: Eclipse - no Java (JRE) / (JDK) ... no virtual machine
If you already got this, go to Window -> Android SDK and AVD preferences
The first "preference" should ask you your Android SDK folder. you need to set this correctly.
Your JDK installation is not proper.
Reinstall JDK. It should be working fine.
I also had this problem once. I have done the above to resolve this issue.
You should not delete C:\Windows\System32 folder for this issue, It might lead to OS problems.
adil's answer is the one which finally worked for me (although I had added the jdk\bin to the path and created\set the JAVA_HOME to the same); moving the jdk\din directory before the win\sys32 in the PATH finally allowed me to install the android sdk on win7/64bit

Categories

Resources