2012-03-26 57 views
3

我試圖將Android SDK集成到Eclipse Indigo中。我安裝了ADT插件Android SDK r_17 mac OS,當我進入首選項 - > Android時,出現以下錯誤:Eclipse Android SDK:.class文件中的錯誤版本號

無法創建所選首選項頁面。在.class文件 錯誤版本號

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的信息:

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版本:

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) 

在Eclipse,它是目前設置爲Java編譯器1.5和J2SE JRE 5.0。我也試着用Java Compiler編譯爲1.6和JRE Java SE 6,結果仍然相同。

我在做什麼錯?

回答

3

這是最有可能與現在ADT 17 requiring Java 1.6

的Java 1.6或更高版本的ADT 17.0.0。

因此,您需要將Java版本從1.5.0_30更新到更新的版本。

+0

我無法安裝Java 1.6,因此我安裝了ADT 16.0.1,現在它可以工作。謝謝。 – 2012-03-27 13:38:50

+0

請問downvoter爲什麼? – 2012-05-23 19:15:17

0

很顯然,錯誤在於.class文件,它不是java的一部分,而是(我相信)錯誤所在的apk(就像隱藏的豹一樣,當你打開首選項時等待打擊)。你有沒有嘗試重新安裝apk?這可能是因爲你的下載足以導致問題。這種情況在.iso文件中會發生很多,但即使是像apk下載一樣小的東西也可能會搞砸。嘗試從系統中徹底清除並重新安裝它(與工具一起,錯誤也可能在那裏)。如果這不是你的問題,你可以去跟蹤這個所謂的.class文件(使用瀏覽器搜索)並找到版本號說什麼。任何這些都是一種選擇。

希望這有助於

-JXP

0

我也有這個問題。我只是通過下載最新版本的Eclipse來解決它,並從頭開始重新安裝Android工具和SDK。

請注意,我只使用64位Eclipse成功。 32位版本不適合我。

我正在運行Mac OS X 10.5 Leopard。當問題發生時,我的Java 1.6運行,所以我不必更新JRE或JDK來解決問題。

該解決方案由薩蒂揚Kandula在下面的鏈接給出: https://bugs.eclipse.org/bugs/show_bug.cgi?id=376434

0

更新了我的JDK我的Mac(運行Leopard),刪除的Eclipse SDK &。重新安裝Eclipse(64位版本)& SDK,並獲得成功。

相關問題