Android Device Monitor not found JDK Path

若如初见. 提交于 2019-12-12 09:35:00

问题


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 ?


回答1:


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)




回答2:


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




回答3:


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"




回答4:


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.



来源:https://stackoverflow.com/questions/38113596/android-device-monitor-not-found-jdk-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!