I have a project that uses a few other library projects (SlidingMenu, ActionbarSherlock) and both of these use the android support library, when building I am getting the following:
UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/LoaderManager; 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:490) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459) at com.android.dx.command.dexer.Main.access$400(Main.java:67) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398) 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:422) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333) at com.android.dx.command.dexer.Main.run(Main.java:209) at com.android.dx.command.dexer.Main.main(Main.java:174) at com.android.dx.command.Main.main(Main.java:91)
Both library projects have a dependency on support lib:
dependencies { compile files('libs/android-support-v4.jar') }
This is now possible by downloading Android Support Repository
from the SDK Manager, and replacing
compile files("libs/android-support-v4.jar")
with
compile 'com.android.support:support-v4:13.0.0'
This has to be done for all projects that use the support library. The Android Support Repository is automatically added to your list of repositories by the build system (Unsure of which part adds it, don't know enough gradle yet).
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With