Android IllegalArgumentException: already added

I created an Android application that uses android-support-v4.jar . Now, when I add the android library for this project, I get this error when creating:

 UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl; [2012-11-08 16:02:31 - ShoppingApp Android] Conversion to Dalvik format failed with error 1 

The library I'm trying to add is the Facebook SDK, which is also used to support android-v4.jar. The only solution for this error that I found is to remove the library from one of the construction paths, but I can’t do this - all options are disabled when I select this jar.

Here is the complete error:

 UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl; at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123) at com.android.dx.dex.file.DexFile.add(DexFile.java:163) at com.android.dx.command.dexer.Main.processClass(Main.java:486) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455) at com.android.dx.command.dexer.Main.access$400(Main.java:67) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109) at com.android.dx.command.dexer.Main.processOne(Main.java:418) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329) at com.android.dx.command.dexer.Main.run(Main.java:206) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:180) at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:703) at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:577) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396) at org.eclipse.core.internal.resources.Project$1.run(Project.java:618) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344) at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597) at org.eclipse.core.internal.resources.Project.build(Project.java:124) at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1000) at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53) [2012-11-08 16:02:31 - ShoppingApp Android] Dx 1 error; aborting [2012-11-08 16:02:31 - ShoppingApp Android] Conversion to Dalvik format failed with error 1 
+8
android facebook dalvik
source share
2 answers

The assembly process checks the checksum of each bank and raises this error if the bank is found twice and the banks have different checksums.

This means that you have the same library twice, but two different versions of the jar file, which makes no sense.

If you added a library project, you do not need a support library in your application, you can delete it, since it is inherited from the project library.

You might want to update the support library jar in the library project.

Edit: you no longer play with the build method, your library folders should be “libs”, and it will appear in the project as “Android dependencies”. Then you delete the jar from your libs folder of your application and possibly update it from the library project.

+11
source share

This error means that you have several classes included in the assembly several times. I solved the same problem with mvn dependencies in eclipse by unchecking "Export maven decencies" in "Project configuration / Path / Export Java assembly".

+1
source share

All Articles