简体   繁体   中英

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

请将包含javaw.exe的文件夹的位置添加到系统PATH环境变量中:例如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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM