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

后端 未结 8 2048
醉酒成梦
醉酒成梦 2020-12-09 08:11

I am getting the following error when trying to launch Android Device Monitor from the Tools window in Android Studio on a Mac.

and when I open the log file

相关标签:
8条回答
  • 2020-12-09 08:40

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

    0 讨论(0)
  • 2020-12-09 08:42

    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....

    0 讨论(0)
  • 2020-12-09 08:44

    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.

    0 讨论(0)
  • 2020-12-09 08:52

    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

    0 讨论(0)
  • 2020-12-09 08:55

    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.

    0 讨论(0)
  • 2020-12-09 08:58

    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)
    
    0 讨论(0)
提交回复
热议问题