Begginer
Begginer

Reputation: 146

Android Device Monitor not opening

I am unable to run Android Monitor. I am using Android Studio. Not Eclipse.

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.eclipse.osgi.internal.baseadaptor.BaseStorage (file:/Users/kidus11/Library/Android/sdk/tools/lib/monitor-x86_64/plugins/org.eclipse.osgi_3.8.2.v20130124-134944.jar) to method java.net.URLClassLoader.addURL(java.net.URL) WARNING: Please consider reporting this to the maintainers of org.eclipse.osgi.internal.baseadaptor.BaseStorage WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

Here is the tag I see every time I try to open Android Device Monitor

!ENTRY org.eclipse.osgi 4 0 2017-10-04 20:18:12.531 !MESSAGE Application error !STACK 1 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini). at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438)

Any help would be greatly appreciated!

Upvotes: 10

Views: 8193

Answers (6)

crifan
crifan

Reputation: 14328

  • reason: monitor not support java 8+
  • solution: change Java (your java 9) to Java 8

Append

how set Java 8 in macOS

  • find java home path
 /usr/libexec/java_home -V
Matching Java Virtual Machines (4):
    11.0.2 (x86_64) "Oracle Corporation" - "OpenJDK 11.0.2" /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
    1.8.333.02 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_112 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home
    1.7.0_79 (x86_64) "Oracle Corporation" - "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
  • added into boot script
 cat ~/.bashrc | grep JAVA
#export JAVA_HOME=$(/usr/libexec/java_home)
#export JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH

Upvotes: 0

takezoux2
takezoux2

Reputation: 193

You modify Info.plist file in monitor binary directory.

Path example in Mac: 
/Users/{username}/Library/Android/sdk/tools/lib/monitor.app/Contents/Info.plist

Add -vm key of bundled java path into <key>Eclipse</key><array>.(There is a comment.You read it.)

-vm key example

<string>-vm</string><string>/Applications/Android\ 
Studio.app/Contents/jre/jdk/Contents/Home/bin/java</string>

Upvotes: 4

Ekta Bhawsar
Ekta Bhawsar

Reputation: 746

Yes, The Newest Android Studio Bundle comes with its own JRE (under C:\Program Files\Android\Android Studio\jre).

So, You can just copy this jre folder and paste it to here: C:\Users\<Username>\AppData\Local\Android\Sdk\tools\lib\monitor-x86_64

And now in android studio go to the Tools -> Android -> Android Device Monitor.

Or you can prefer this link Resolve Android Device Monitor issue

Upvotes: 5

Ana
Ana

Reputation: 31

Not sure what is your use case for Android Device Monitor, but apparently since Android Studio 3.0. most components of the Android Device Monitor are deprecated:

https://developer.android.com/studio/profile/monitor.html

There are other tools that can be used such as Android Profiler...

So maybe it is not really necessary to try to fix this issue.

Upvotes: 3

user1998382
user1998382

Reputation: 111

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)

Upvotes: 8

Sam
Sam

Reputation: 5392

Android Studio does not support Java 9 yet. Install JDK 8 and update your studio configurations to point the jre for 8.

Then ensure that you are not setting your JAVA_HOME to 9 yet either. Lastly, make sure you eclipse is not running somewhere on your machine taking ownership of the ADB already.

Upvotes: 13

Related Questions