使用ActionBarSherlock和放大器; ViewPagerIndicator Syncronously不会编译 [英] Using ActionBarSherlock & ViewPagerIndicator Syncronously Will Not Compile

查看:142
本文介绍了使用ActionBarSherlock和放大器; ViewPagerIndicator Syncronously不会编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用ActionBarSherlock和ViewPagerIndicator在同一时间我收到下面的错误;从我读过 - 它是由于这两个相互矛盾的/重复的库引起的。

When using ActionBarSherlock and ViewPagerIndicator at the same time I am getting the below error; from what I've read - it's caused due to conflicting/duplicate libraries in the two.

一个解决办法是有ABS依靠VPI(或其他方式,我都试过),但即使经过清洁和重建,这仍然给了我同样的错误。现在我只是在工作的两个独立的项目,所以我可以让我的工作做了 - 但我想他们明明结合公顷。帮助将非常AP preciated!

One solution was to have ABS rely on VPI (Or the other way around, I tried both) but this still gave me the same error even after a clean and rebuild. Right now I'm just working in two separate projects so I can get my work done - but I'd like to combine them obviously ha. Help would be much appreciated!

[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到项目,就像您的常规项目 - 为那些你们谁可能会想向后)。我仍然有与问题,当我得到我的code错误说法的一些方法不能被覆盖 - 这部分是因为你有错误的进口,所以删除所有进口CRTL + SHIFT + O(快速导入分辨率),然后从android.support.v4工具包的所有的人,你应该都好这一点。但后来我还是遇到了原来的Dalvik的问题 - 要解决这个问题,我不得不去到实际的文件夹,我的VPI库是从/库中删除的支持JAR文件夹的位置抓住它阻止它 - 那么所有的设置:)

UPDATE WITH ANSWER: Alright - as the answer below gets at, the issue was the dependency resolution in the Eclipse ADT. Basically my solution was to make the ViewPagerIndicator rely on ActionBarSherlock (Meaning, in the VPI properties, I add ABS to the project like you would for a regular project - for those of you who might be thinking backwards). I still had issues with that when I was getting errors in my code saying some of the methods couldn't be overridden - this part is because you have the wrong imports, so delete all your imports and CRTL+SHIFT+O (Quick import resolution) and select all the ones from the android.support.v4 packages and you should be all good on that. But then I still ran into the original Dalvik issue - to fix this I had to go into the actual folder where my VPI library was and delete the support jar from the /libs folder to stop it from grabbing it - then all set :)

推荐答案

是的,这个问题既是ActionBarSherlock和ViewPagerIndicator使用库/ Android的支持,v4.jar依赖。

Yes, the problem is both ActionBarSherlock and ViewPagerIndicator use libs/android-support-v4.jar dependency.

最简单的办法是升级你的工作站到最新的Andr​​oid SDK和Eclipse ADT插件版本(至少R17),因为这种情况是由SDK现在会自动处理(因为R17),看到的r17的changelog

The simplest solution is upgrade your work station to latest Android SDK and Eclipse ADT plugin version (at least r17), as this situation is automatically handled by the SDK now (since r17), see the r17 changelog:

当一个项目引用都需要相同的jar文件中的两个库项目,构建系统具有检测和解决重复。

Dependency resolution

When a project references two Library projects that both require the same jar file, the build system has to detect and resolve the duplication.

另外请注意,由于R17,下libs文件夹中的所有jar文件将自动填充到项目的类路径中,你不需要手动添加到项目的构建路径了,在的 R17的changelog

Also Note that since r17, all jar file under libs folder are automatically populated to project's classpath, you don't need manually add them to project's build path anymore, also mentioned in the r17 changelog:

项目源文件夹,以及库项目和JAR文件相关性。随着需要的不是增加库项目中project.properties依赖任何其他的设置,项目的类路径会自动填充:

Projects have source folders, as well as Library Project and jar file dependencies. With no other setup needed than adding Library Projects as a dependency in project.properties, a project’s classpath is automatically populated with:

      
  • 项目库的内容/ *。罐
  •   
  • 的库项目的输出。
  •   
  • 在图书馆项目库/ *。罐
  •   
  • The content of the project’s libs/*.jar
  • The output of the Library Projects.
  • The Library Projects’ libs/*.jar

希望这有助于。

这篇关于使用ActionBarSherlock和放大器; ViewPagerIndicator Syncronously不会编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆