同时使用 ActionBarSherlock 和 ViewPagerIndicator 时,出现以下错误;根据我的阅读 - 这是由于两者中的冲突/重复库引起的。
一种解决方案是让 ABS 依赖于 VPI(或者相反,我都尝试了)但是即使在清理和重建之后,这仍然给了我同样的错误。现在我只是在两个独立的项目中工作,所以我可以完成我的工作——但我显然想把它们结合起来哈。帮助将不胜感激!
[2012-04-19 00:39:20 - MashableReader] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.dx.command.dexer.Main.run(Main.java:206)
[2012-04-19 00:39:20 - MashableReader] Dx at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2012-04-19 00:39:20 - MashableReader] Dx at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2012-04-19 00:39:20 - MashableReader] Dx at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2012-04-19 00:39:20 - MashableReader] Dx at java.lang.reflect.Method.invoke(Unknown Source)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:180)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:702)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:646)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.internal.resources.Project.build(Project.java:124)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1000)
[2012-04-19 00:39:20 - MashableReader] Dx at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132)
[2012-04-19 00:39:20 - MashableReader] Dx at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2012-04-19 00:39:20 - MashableReader] Dx 1 error; aborting
[2012-04-19 00:39:20 - MashableReader] Conversion to Dalvik format failed with error 1
更新答案: 好的 - 正如下面的答案所得到的,问题是 Eclipse ADT 中的依赖关系解析。基本上我的解决方案是让 ViewPagerIndicator 依赖于 ActionBarSherlock(意思是,在 VPI 属性中,我将 ABS 添加到项目中,就像您在常规项目中所做的那样 - 对于那些可能会向后思考的人)。当我的代码中出现错误说某些方法无法被覆盖时,我仍然遇到了问题 - 这部分是因为您有错误的导入,所以删除所有导入和 CRTL+SHIFT+O(快速导入解决) 并从 android.support.v4 包中选择所有的包,你应该都很好。