简体   繁体   English

找不到Android设备监视器JDK路径

[英]Android Device Monitor not found JDK Path

I'm using Arch Linux with Gnome. 我正在将Arch Linux与Gnome一起使用。

I open Android Studio by the desktop item. 我通过桌面项打开Android Studio。 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. Java运行时环境(JRE)或Java开发工具包(JDK)必须可用才能运行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. 在以下位置搜索以下位置后未找到Java虚拟机:/ home / grams / Android / Sdk / tools / lib / monitor-x86_64 / jre / bin / java您当前路径中的java当我从命令行运行android studion时,设备监视器工作。

Here is the .desktop content 这是.desktop内容

#!/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. 我的JRE和JDK变量正在/ etc / profile中添加。 When i run Android Studio on the command line, this error not occurs. 当我在命令行上运行Android Studio时,不会发生此错误。 Maybe it is a problem with Gnome launcher ? 也许Gnome启动器有问题?

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). 最新的Android Studio捆绑包带有自己的JRE(在<ANDROID_STUDIO>/jre下),建议使用此JRE(查看文件/项目结构/ SDK位置)。

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. 同样,一个简单的选择是在监视工具下创建一个符号链接,以使JRE与Android Studio保持一致,甚至获取更新。

For MAC or Linux: 对于MAC或Linux:

#ln -s <ANDROID_STUDIO>/jre <SDK>/tools/lib/monitor-x86_64/jre

32 bits: 32位:

#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 ) 然后ddms监视器可同时用于两种方式:从Studio IDE(工具/ Android / ADM)或命令行( <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. 在用于登录shell的初始化文件中定义环境变量:最有可能是.profile.bash_profile ,具体取决于您的设置。 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? 在以下位置了解更多信息: 我应该哪里手动安装JDK8? and JDK installation on Archlinux 在Archlinux上安装JDK

请将包含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. 确保变量减速命名约定符合规则,并且Android Studio正在按预定义的名称进行搜索。 As in Windows, the Variable that contains JDK path should named: JAVA_HOME Explore the rules. 与Windows中一样,包含JDK路径的变量应命名为: JAVA_HOME探索规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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