可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I can't open the monitor (ddms) in android studio getting following 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: C:\Android-Studio\android-studio\sdk\tools\lib\monitor-x86\jre\bin\javaw.exe javaw.exe in your current PATH
Would appreciate any suggestion how to fix this. thanks
回答1:
You must have your jdk or jre installed and in your path. Considering you are running windows you must go to your environment variables and add the location of one of them to the path. That is assuming you already have one of them installed. If you dont you need to go the oracle website and get one of them.
If you already have it installed go to your systems settings, then go to the advanced settings tab and click Environment variables at the bottom, there you edit the PATH and add the location of your jre or jdk, that should solver your problem.
回答2:
I'm trying adding my JRE path to PATH on Environment variables but doesn't work. Even I try making symbolic link (directories) C:\Android-Studio\android-studio\sdk\tools\lib\monitor-x86\jre\bin\ with C:\Program Files\Java\jre7\bin but doesn't work.
I found a solution and I this is is because Android Studio is updated but SDK Tools don't.
In my case I manually update AS from 0.8.6 to 0.8.12 manually (because updater in 0.8.6 are buggy), but not update SDK Tools.
Finally I update SDK using this post: Can't upgrade Android SDK Tools Can't upgrade Android SDK Tools
Now I have Android Studio (0.8.12) and SDK Tools (23.0.5) ... DDMS open again. :D
回答3:
Monitor is an eclipse RCP, so you can edit ini file to set JRE(or JDK) path.
for example:
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: C:\Android-Studio\android-studio\sdk\tools\lib\monitor-x86\jre\bin\javaw.exe javaw.exe in your current PATH
In this case, your monitor is located in "C:\Android-Studio\android-studio\sdk\tools\lib\monitor-x86". navigate to that path and edit monitor.ini file.
Add follwing line: -vm [your JRE path]
回答4:
Here is what I did in a few steps:
NB: Make sure the PATH of the location of your jre or jdk is set in your Environment Variables before you do these steps
- Close the error dialog box
- Copy JRE folder from Android folder in Program Files, for me it is C:\Program Files\Android\Android Studio
- And paste this JRE folder in your Android SDK monitor-x86_64 location, for me, it is C:\AndroidSdk\tools\lib\monitor-x86_64
- Run the Android Device Monitor again
Hope it's fixed, if not, restart your Android Studio