Using ActionBarSherlock & ViewPagerIndicator will not compile synchronously

When using ActionBarSherlock and ViewPagerIndicator at the same time, I get the following error; from what I read - it is caused by conflicting / duplicate libraries in two.

One solution was to make ABS rely on VPI (or vice versa, I tried both), but it still gave me the same error even after cleaning and restoring. Right now I just work in two separate projects, so I can do my job, but I would like to combine them, obviously, Help will be very 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 

ANSWER UPDATE: Good - as you can see from the answer below, the problem was with dependency resolution in Eclipse ADT. Basically my solution was to get ViewPagerIndicator to rely on ActionBarSherlock (value, in the VPI properties, I add ABS to the project, as for a regular project, for those of you who can think in the opposite direction). I still had problems with this when I was getting errors in my code saying that some of the methods could not be overridden - this part is due to the fact that you have the wrong import, so delete all your import and CRTL + SHIFT + O (quick import resolution) and select all from the android.support.v4 packages, and everything should be fine. But then I still ran into the original Dalvik problem - to fix this, I had to go into the actual folder where my VPI library was and remove the support banner from the / libs folder to stop it from being captured - then everything is installed :)

+6
source share
2 answers

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

The easiest solution is to upgrade the workstation to the latest version of the Android SDK and Eclipse ADT (at least r17), since this situation is automatically processed by the SDK now (with r17), see r17 changelog :

Dependency Resolution

When a project refers to two library projects that require the same jar file, the build system must detect and allow duplication.

Also note that since r17 all jar files under the libs folder are automatically populated in the project class path, you do not need to manually add them to the project build path also mentioned in r17 changelog :

Projects have source folders, as well as library files and jar files. If no other configuration is required than adding library projects as a dependency in project.properties, the path to the project classes is automatically populated with:

  • The contents of the libs / * projects. jar
  • Conclusion of library projects.
  • Library projects libs / *. jar

Hope this helps.

+6
source

I am in the latest version of ADT, SDK, etc., and she still has this problem - she still does not know which support library to use from the dependent library, etc.

The TJ solution works, but I used an alternative approach.

My solution was as follows:

  • Went to each library project and the main application project, which refers to the library and removes the link libs / android-support-v4.jar
  • I returned to each project and dragged android-support-v4.jar from the file system (on my Mac I saved the SDK in the folder of my documents: Users // Documents / Android / android-sdk-mac_x86 / extras / android / compatible / v4 / android -support-v4.jar) to the libs folder and select LINK for jar instead of copying to the project.
  • Now all my projects reference the same .jar file on my file system, and if I update the support library in the future (via the Android SDK Manager), the jar will be updated, and the projects, in turn, a jar.

Therefore, updating the support library should not break anything and allow you to be in the latest version.

0
source

Source: https://habr.com/ru/post/913653/


All Articles