使用 Honeycomb 兼容性包的 IllegalArgumentException
我将兼容性 .jar 添加到我的项目中(使用片段等的项目),但现在每次我构建应用程序时,Eclipse 都会抛出以下错误。我通过将 .jar 复制到 libs/ 文件夹中来添加它,然后在项目属性中使用添加 Jar... /em> 对话框。我这样做对吗?
[TimetableHC] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActivityCompatHoneycomb;
[TimetableHC] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[TimetableHC] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:372)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:59)
[TimetableHC] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
[TimetableHC] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
[TimetableHC] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
[TimetableHC] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:313)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.run(Main.java:185)
[TimetableHC] Dx at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[TimetableHC] Dx at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[TimetableHC] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[TimetableHC] Dx at java.lang.reflect.Method.invoke(Unknown Source)
[TimetableHC] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[TimetableHC] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:585)
[TimetableHC] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:490)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
[TimetableHC] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255)
[TimetableHC] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:220)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:362)
[TimetableHC] Dx at org.eclipse.core.internal.resources.Project$1.run(Project.java:545)
[TimetableHC] Dx at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
[TimetableHC] Dx at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:524)
[TimetableHC] Dx at org.eclipse.core.internal.resources.Project.build(Project.java:115)
[TimetableHC] Dx at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:145)
[TimetableHC] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
[TimetableHC] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
[TimetableHC] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:923)
[TimetableHC] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1126)
[TimetableHC] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[TimetableHC] Dx 1 error; aborting
[TimetableHC] Conversion to Dalvik format failed with error 1
I added the compatibility .jar to my project (the one to use fragments etc) but now every time I build my app Eclipse throws the error below. I added it by copying the .jar into the libs/ folder and then used Add Jar... in the Project Properties dialog. Am I doing this right?
[TimetableHC] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActivityCompatHoneycomb;
[TimetableHC] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[TimetableHC] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:372)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:59)
[TimetableHC] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
[TimetableHC] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
[TimetableHC] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
[TimetableHC] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:313)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
[TimetableHC] Dx at com.android.dx.command.dexer.Main.run(Main.java:185)
[TimetableHC] Dx at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[TimetableHC] Dx at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[TimetableHC] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[TimetableHC] Dx at java.lang.reflect.Method.invoke(Unknown Source)
[TimetableHC] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:179)
[TimetableHC] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:585)
[TimetableHC] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:490)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:629)
[TimetableHC] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:172)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:203)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:255)
[TimetableHC] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:258)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:220)
[TimetableHC] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:362)
[TimetableHC] Dx at org.eclipse.core.internal.resources.Project$1.run(Project.java:545)
[TimetableHC] Dx at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
[TimetableHC] Dx at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:524)
[TimetableHC] Dx at org.eclipse.core.internal.resources.Project.build(Project.java:115)
[TimetableHC] Dx at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:145)
[TimetableHC] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
[TimetableHC] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
[TimetableHC] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:923)
[TimetableHC] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1126)
[TimetableHC] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[TimetableHC] Dx 1 error; aborting
[TimetableHC] Conversion to Dalvik format failed with error 1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所描述的过程是正确的。然而,Android 构建工具认为您已经添加了两次。您是否还将它添加为您的项目正在引用的 Android 库项目,或者其他什么?
Your described process is correct. However, the Android build tools think you have added it twice. Did you also add it as an Android library project that your project is referencing, or something?