Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

enter image description here

and when I open the log file I find an error report very similar to the other SO questions similar to this, esp this one. However, using sudo did not work for me, although I get similar, though much shorter, error data:

Macs-MBP:tools macuser$ sudo ./monitor
Password:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/archquery/Main : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
./monitor: line 41: /Users/macuser/Library/Android/sdk/tools/lib/monitor-/monitor.app/Contents/MacOS/monitor: No such file or directory
./monitor: line 41: exec: /Users/macuser/Library/Android/sdk/tools/lib/monitor-/monitor.app/Contents/MacOS/monitor: cannot execute: No such file or directory

Backstory: After doing a complete, new Android Studio installation on this laptop (El Capitan) I attempted to launch the monitor from inside the IDE. It complained that running it required Java 1.6. So I installed Java 6. Then when I tried it I got the error message above.

I get the following when I ran from Terminal java_home -V

Matching Java Virtual Machines (2):
    1.6.0_65-b14-468, x86_64:   "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

The contents of the log file are (unfortunately had to cull some because of text entry limitations for post):

!SESSION 2017-03-07 14:46:16.923 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_65
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -keyring /Users/macuser/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -data @noDefault -keyring /Users/macuser/.eclipse_keyring -showlocation

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.397
!MESSAGE Bundle reference:file:org.apache.ant_1.8.3.v201301120609/@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.400
!MESSAGE Bundle reference:file:org.apache.jasper.glassfish_2.2.2.v201205150955.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.401
!MESSAGE Bundle reference:file:org.apache.lucene.core_2.9.1.v201101211721.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.424
!MESSAGE Bundle reference:file:org.eclipse.help.base_3.6.101.v201302041200.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.425
!MESSAGE Bundle reference:file:org.eclipse.help.ui_3.5.201.v20130108-092756.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.425
!MESSAGE Bundle reference:file:org.eclipse.help.webapp_3.6.101.v20130116-182509.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.426
!MESSAGE Bundle reference:file:org.eclipse.jetty.server_8.1.3.v20120522.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.429
!MESSAGE Bundle reference:file:org.eclipse.platform.doc.user_4.2.2.v20130121-200410.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.430
!MESSAGE Bundle reference:file:org.eclipse.team.core_3.6.100.v20120524-0627.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.430
!MESSAGE Bundle reference:file:org.eclipse.team.ui_3.6.201.v20130125-135424.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.431
!MESSAGE Bundle reference:file:org.eclipse.ui.cheatsheets_3.4.200.v20120521-2344.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.432
!MESSAGE Bundle reference:file:org.eclipse.ui.intro_3.4.200.v20120521-2344.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:17.924
!MESSAGE An error occurred while automatically activating bundle com.android.ide.eclipse.monitor (4).
!STACK 0
org.osgi.framework.BundleException: The activator com.android.ide.eclipse.monitor.MonitorPlugin for bundle com.android.ide.eclipse.monitor is invalid
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:172)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
    at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:263)
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:469)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:464)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:340)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1212)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:191)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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)
Caused by: java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocation$AndroidLocationException : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:632)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:614)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at com.android.ide.eclipse.monitor.MonitorPlugin.<clinit>(MonitorPlugin.java:28)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:357)
    at java.lang.Class.newInstance(Class.java:310)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:167)
    ... 33 more

!ENTRY org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.http.jetty_3.0.1.v20121109-203239.jar was not resolved.
!SUBENTRY 2 org.eclipse.equinox.http.jetty 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing imported package org.eclipse.jetty.server.ssl_[8.0.0,9.0.0).
!SUBENTRY 2 org.eclipse.equinox.http.jetty 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing imported package org.eclipse.jetty.server.nio_[8.0.0,9.0.0).
!SUBENTRY 2 org.eclipse.equinox.http.jetty 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing imported package org.eclipse.jetty.server.session_[8.0.0,9.0.0).
!SUBENTRY 2 org.eclipse.equinox.http.jetty 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing imported package org.eclipse.jetty.server_[8.0.0,9.0.0).
!SUBENTRY 2 org.eclipse.equinox.http.jetty 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing imported package org.eclipse.jetty.server.bio_[8.0.0,9.0.0).
!SUBENTRY 2 org.eclipse.equinox.http.jetty 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing imported package org.eclipse.jetty.server.handler_[8.0.0,9.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.ltk.ui.refactoring_3.7.0.v20120523-1543.jar was not resolved.
!SUBENTRY 2 org.eclipse.ltk.ui.refactoring 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing required bundle org.eclipse.team.core_[3.4.100,4.0.0).
!SUBENTRY 2 org.eclipse.ltk.ui.refactoring 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing required bundle org.eclipse.team.ui_[3.4.100,4.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.platform_4.2.2.v201302041200/ was not resolved.
!SUBENTRY 2 org.eclipse.platform 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing required bundle org.eclipse.ui.intro_[3.2.0,4.0.0).
!SUBENTRY 2 org.eclipse.platform 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(|(&(osgi.ee=JavaSE)(version=1.4))(&(osgi.ee=CDC/Foundation)(version=1.0))(&(osgi.ee=JavaSE)(version=1.3)))".
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.ui.intro.universal_3.2.600.v20120912-155524/ was not resolved.
!SUBENTRY 2 org.eclipse.ui.intro.universal 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing required bundle org.eclipse.ui.intro_[3.4.0,4.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.jsp.jasper_1.0.400.v20120912-130548.jar was not resolved.
!SUBENTRY 2 org.eclipse.equinox.jsp.jasper 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing imported package org.apache.jasper.servlet_[0.0.0,6.0.0).
!SUBENTRY 2 org.eclipse.equinox.jsp.jasper 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(|(&(osgi.ee=CDC/Foundation)(version=1.0))(&(osgi.ee=JavaSE)(version=1.3)))".
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE Bundle initial@reference:file:plugins/org.apache.lucene_2.9.1.v201101211721.jar was not resolved.
!SUBENTRY 2 org.apache.lucene 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing required bundle org.apache.lucene.core_[2.9.1,3.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.jetty.security_8.1.3.v20120522.jar was not resolved.
!SUBENTRY 2 org.eclipse.jetty.security 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing imported package org.eclipse.jetty.server_[8.1.0,9.0.0).
!SUBENTRY 2 org.eclipse.jetty.security 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing imported package org.eclipse.jetty.server.handler_[8.1.0,9.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE Bundle initial@reference:file:plugins/org.apache.lucene.analysis_2.9.1.v201101211721.jar was not resolved.
!SUBENTRY 2 org.apache.lucene.analysis 2 0 2017-03-07 14:46:18.017
!MESSAGE Missing required bundle org.apache.lucene.core_[2.9.1,3.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.017
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.jetty.servlet_8.1.3.v20120522.jar was not resolved.
!SUBENTRY 2 org.eclipse.jetty.servlet 2 0 2017-03-07 14:46:18.018
!MESSAGE Missing imported package org.eclipse.jetty.server.handler_[8.1.0,9.0.0).
!SUBENTRY 2 org.eclipse.jetty.servlet 2 0 2017-03-07 14:46:18.018
!MESSAGE Missing imported package org.eclipse.jetty.server.session_[8.1.0,9.0.0).
!SUBENTRY 2 org.eclipse.jetty.servlet 2 0 2017-03-07 14:46:18.018
!MESSAGE Missing imported package org.eclipse.jetty.server.nio_[8.1.0,9.0.0).
!SUBENTRY 2 org.eclipse.jetty.servlet 2 0 2017-03-07 14:46:18.018
!MESSAGE Missing imported package org.eclipse.jetty.server_[8.1.0,9.0.0).
!SUBENTRY 2 org.eclipse.jetty.servlet 2 0 2017-03-07 14:46:18.018
!MESSAGE Missing imported package org.eclipse.jetty.server.ssl_[8.1.0,9.0.0).
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.018
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.equinox.jsp.jasper.registry_1.0.300.v20120912-130548.jar was not resolved.
!SUBENTRY 2 org.eclipse.equinox.jsp.jasper.registry 2 0 2017-03-07 14:46:18.018
!MESSAGE Missing required capability Require-Capability: osgi.ee; filter="(|(&(osgi.ee=CDC/Foundation)(version=1.0))(&(osgi.ee=JavaSE)(version=1.3)))".

!ENTRY org.eclipse.osgi 2 0 2017-03-07 14:46:18.037
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2017-03-07 14:46:18.037
!MESSAGE Bundle org.apache.lucene_2.9.1.v201101211721 [24] was not resolved.
!SUBENTRY 2 org.apache.lucene 2 0 2017-03-07 14:46:18.037
!MESSAGE Missing required bundle org.apache.lucene.core_[2.9.1,3.0.0).
!SUBENTRY 2 org.apache.lucene 2 0 2017-03-07 14:46:18.037
!MESSAGE Missing optionally required bundle org.apache.lucene.analysis_[2.9.1,3.0.0).
!SUBENTRY 2 org.apache.lucene 2 0 2017-03-07 14:46:18.037
!MESSAGE Missing optionally required bundle org.apache.lucene.highlighter_[2.9.1,3.0.0).
!SUBENTRY 2 org.apache.lucene 2 0 2017-03-07 14:46:18.037
!MESSAGE Missing optionally required bundle org.apache.lucene.memory_[2.9.1,3.0.0).
!SUBENTRY 2 org.apache.lucene 2 0 2017-03-07 14:46:18.037
!MESSAGE Missing optionally required bundle org.apache.lucene.queries_[2.9.1,3.0.0).

. . .

!ENTRY org.eclipse.osgi 4 0 2017-03-07 14:46:18.041
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in com.android.ide.eclipse.monitor was unable to load class com.android.ide.eclipse.monitor.MonitorApplication.
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
    at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:176)
    at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:191)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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)
Caused by: org.osgi.framework.BundleException: The activator com.android.ide.eclipse.monitor.MonitorPlugin for bundle com.android.ide.eclipse.monitor is invalid
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:172)
    at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679)
    at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:300)
    at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
    at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:263)
    at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
    ... 27 more
Caused by: java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocation$AndroidLocationException : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:632)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:614)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
    at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at com.android.ide.eclipse.monitor.MonitorPlugin.<clinit>(MonitorPlugin.java:28)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:357)
    at java.lang.Class.newInstance(Class.java:310)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:167)
    ... 33 more
like image 475
Alyoshak Avatar asked Mar 08 '17 01:03

Alyoshak


2 Answers

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
like image 69
James Nelson Avatar answered Oct 24 '22 18:10

James Nelson


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)
like image 7
Inti Avatar answered Oct 24 '22 19:10

Inti