I'm trying to use my aar-library (a maven project, built with the android-maven-plugin by Jayway) in a gradle project but, when I run gradle assembleDebug, I'm having 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 search that class in my project, Android Studio finds 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 the inspection 
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 is in aar-library classes.jar: ListIntentIntents (and, obviously, the whole play-services-base module) is already there! So inside 
my-gradle-project/app/build/intermediates/exploded-aar/
I have two references of play-services-base module: one under com.google.android.gms folder, one under aar-library folder
What should I do?
I've found the culprit! I was using the old android maven plugin                 com.jayway.maven.plugins.android.generation2
The new one com.simpligility.maven.plugins fixed the error.
Anyway thanks for the help.
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