I am trying to use my aar library (the maven project created using the android-maven-plugin from Jayway) in the gradle project, but when I run gradle assembleDebug , I have the following exception:
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/actions/ItemListIntents; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334) at com.android.dx.command.dexer.Main.run(Main.java:277) at com.android.dx.command.dexer.Main.main(Main.java:245) at com.android.dx.command.Main.main(Main.java:106)
If I look for this class in my project, Android Studio will find two results:
ListItemIntents (com.google.android.gms.action) play-services-base-7.0.0(classes.jar)ListItemIntents (com.google.android.gms.action) aar-library(classes.jar)
Running gradle dependencyInsight --dependency play-services-base --configuration compile I get:
com.google.android.gms:play-services-base:7.0.0 +--- com.google.android.gms:play-services-gcm:7.0.0 | \--- aar-library:core:1.0.10-SNAPSHOT | \--- compile +--- com.google.android.gms:play-services-location:7.0.0 | \--- com.nexse.mobile.betting.core:core:1.0.10-SNAPSHOT (*) \--- com.google.android.gms:play-services-maps:7.0.0 \--- com.google.android.gms:play-services-location:7.0.0 (*) (*) - dependencies omitted (listed previously)
The problem in the classes.jar library: ListIntentIntents (and, obviously, the entire module of game services) already exists! So inside
my-gradle-project/app/build/intermediates/exploded-aar/
I have two links to the play-services-base module: one in the com.google.android.gms folder, one in the aar-library folder
What should I do?
source share