Android Device Monitor will not launch, either from Android Studio or from Terminal — UnsupportedClassVersionError

一笑奈何 提交于 2019-11-28 08:06:54
James Nelson

I'm having the same issue. Based on the log file, the new version of Android Studio requires Java 8 "Unsupported major.minor version 52.0": Unsupported major.minor version 52.0

I'm running Linux, I currently have java8 installed so I just needed to use:

update-alternatives --config java

and

update-alternatives --config javac

then everything worked.

It looks as though you're using a Mac, so you may or may not need to do the following after installing Java 8: Installed Java 7 on Mac OS X but Terminal is still using version 6

Info from Unsupported major.minor version 52.0 source: wikipedia

  • J2SE 8 = 52
  • J2SE 7 = 51
  • J2SE 6.0 = 50
  • J2SE 5.0 = 49
  • JDK 1.4 = 48
  • JDK 1.3 = 47
  • JDK 1.2 = 46
  • JDK 1.1 = 45

Confusingly I didn't have Java 8 installed in a shared location (only the bundled version in Android Studio). Installing it through homebrew solved my problem.

brew cask install java

$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Android Studio comes with built-in Java 1.8, so it wasn't a problem when you are developing android app. But when you launch Android Device Monitor, it uses external java compiler that run on your OS. If you have preinstalled Java before, it won't be a problem. Otherwise, you will face the same problem.

I tried to set JAVA_HOME path to java packed in Android Studio. It does not work, probably because it is openjdk version.

My solution was to download Java JDK 1.8 from Oracle and install in my computer.

If you open the particular error message you will see the first few line of the error message as below.

!SESSION 2017-12-20 08:17:02.597 -----------------------------------------------
eclipse.buildId=unknown
java.version=9.0.1
java.vendor=Oracle Corporation

This is what I got. I have installed both java 8 and 9 in my mac and made java 8 as the default. According to the error message java virtual device took java 9 but its need 8. Thats where the probelm happened.So I uninstalled the java 9 from my machine then its started to work fine.

The above answer didn't work for me. I'm using JAVA8, both the Android JAVA_HOME and /usr/bin/java. What is weirder for me is my tools/ directory is missing the uiautomationviewer tool as well. So it made me wonder if something went wrong during the installation.

What I ended up doing was downloading an older verion of SDK-tools (I followed instructions here), and replaced the entire sdk/tools folder. And it worked....

Same problem was observed on: macOS Sierra 10.12.6 Android Studio 3.0.1

Was solved by: Uninstalling Java SE Development Kit 8u152 And Installing Java SE Development Kit 8u151 from: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Try to right click sdk/tools/monitor.bat and Click "run as administrator"

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