Eclipse Android SDK: Wrong version number in .class file
I am trying to integrate Android SDK into my Eclipse Indigo. I have installed ADT plugin for Android SDK r_17 mac OS and when I go to Preferences-> Android the following error appears:
Unable to create the selected preference page. Invalid version number in .class file
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:608)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
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.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:268)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:264)
at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceNode.createPage(WorkbenchPreferenceNode.java:47)
at org.eclipse.jface.preference.PreferenceDialog.createPage(PreferenceDialog.java:1339)
at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.createPage(FilteredPreferenceDialog.java:376)
at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1230)
at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.showPage(FilteredPreferenceDialog.java:674)
at org.eclipse.jface.preference.PreferenceDialog$10.run(PreferenceDialog.java:708)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.preference.PreferenceDialog$9.selectionChanged(PreferenceDialog.java:704)
at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:888)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:886)
at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1726)
at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer.java:1139)
at org.eclipse.jface.preference.PreferenceDialog.selectSavedItem(PreferenceDialog.java:1054)
at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.selectSavedItem(FilteredPreferenceDialog.java:729)
at org.eclipse.jface.preference.PreferenceDialog$4.run(PreferenceDialog.java:375)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.preference.PreferenceDialog.createContents(PreferenceDialog.java:371)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
at org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog.createDialogOn(WorkbenchPreferenceDialog.java:102)
at org.eclipse.ui.dialogs.PreferencesUtil.createPreferenceDialogOn(PreferencesUtil.java:192)
at org.eclipse.ui.dialogs.PreferencesUtil.createPreferenceDialogOn(PreferencesUtil.java:116)
at org.eclipse.ui.internal.handlers.ShowPreferencePageHandler.execute(ShowPreferencePageHandler.java:53)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:178)
at org.eclipse.ui.internal.cocoa.CocoaUIEnhancer.runCommand(CocoaUIEnhancer.java:393)
at org.eclipse.ui.internal.cocoa.CocoaUIEnhancer.actionProc(CocoaUIEnhancer.java:535)
at org.eclipse.ui.internal.cocoa.CocoaUIEnhancer.actionProc(CocoaUIEnhancer.java:520)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:4879)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5226)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.nextEventMatchingMask(NSApplication.java:94)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3607)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:592)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Eclipse info:
eclipse.buildId=M20120208-0800
java.version=1.5.0_30
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=cocoa, NL=fr_FR
Framework arguments: -keyring /Users/stef/.eclipse_keyring -showlocation
Command-line arguments: -os macosx -ws cocoa -arch x86 -keyring /Users/stef/.eclipse_keyring -showlocation
Java version:
java -version
java version "1.5.0_30"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_30-b03-389-9M3425)
Java HotSpot(TM) Client VM (build 1.5.0_30-161, mixed mode, sharing)
In Eclipse it currently has Java Compiler 1.5 and JRE J2SE 5.0 installed. I've also tried with Java Compiler up to 1.6 and JRE Java SE 6, all the same result.
What am I doing wrong?
source to share
This is most likely due to ADT 17 requiring Java 1.6 :
ADT 17.0.0 requires Java 1.6 or later.
So, you need to update your Java version from 1.5.0_30 to later.
source to share
Obviously the error lies in the .class file, which is not part of java, but rather (I believe) apk, that the error lies inside (like a hidden panther waiting to be hit when you open the settings). Have you tried reinstalling apk? It could be that your download is out of order enough to cause problems. This happens very often with .iso files, but even something smaller than downloading an apk can mess up. Try to completely clean it from your system and reinstall it (along with the tools, the error could be there too). If that's not your problem, you can trace this so-called .class file (using a search engine) and see what the version number says. Any of these are optional.
Hope it helps,
-JXP
source to share
I had this problem too. I just solved it by downloading the latest version of Eclipse and installing Android tools and SDK from scratch.
Please note that I was only successful using 64 bit Eclipse. 32 bit didn't work for me.
I am running Mac OS X 10.5 Leopard. I had Java 1.6 running at the time the problem occurred, so I didn't need to update the JRE or JDK to fix the problem.
The solution was given by Satyam Kandula at the link below: https://bugs.eclipse.org/bugs/show_bug.cgi?id=376434
source to share
Similar, if not the same problem as OP. I've tried several different things (for example): Old SDK, Old ADT plugin. I am using OS X (10.5).
I ended up installing 64-bit Eclipse (eclipse-SDK-3.7.2-macosx- cocoa -x86_64.tar.gz) and it looks fine.
Will be updated if any problems occur.
source to share