com.android.dex.DexException: Multiple dex files define Landroid/support/v13/app/FragmentCompat23;
UNEXPECTED TOP-LEVEL EXCEPTION:
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)
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)
Where did this error occur?
Latest Android Studio 1.4 using a gradle built.
What type of exception?
Runtime exception when starting an Android project.What programming language and version?
Java 1.7What dependencies?
The following dependencies are used.dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'joda-time:joda-time:2.8.2'
compile 'com.wefika:flowlayout:0.4.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
compile 'com.makeramen:dragsortadapter:1.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.adw.library:discrete-seekbar:1.0.0'
compile 'com.android.support:preference-v7:23.0.1'
compile 'com.android.support:preference-v14:23.0.1'
compile 'com.android.support:palette-v7:23.0.1'
compile 'com.android.support:support-v13:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
}
THE SOLUTION
Other found issues on the web
On stackoverflow, in one case a similiar bug has this solution
The problem was in apkLib dependency and confuse msg from Gradle.
The one who asked this question could solve this problem this way:
this error appeared to me when I imported some libs that required Google Play services,
I just passed from:
http://stackoverflow.com/questions/25384166/multiple-dex-files-define-landroid-support-v4-accessibilityservice-accessibility
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile ('com.google.android.gms:play-services-gcm:8.1.0') {
exclude module: 'support-v4'
}
compile 'joda-time:joda-time:2.8.2'
compile 'com.wefika:flowlayout:0.4.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
compile 'com.makeramen:dragsortadapter:1.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.adw.library:discrete-seekbar:1.0.0'
compile 'com.android.support:preference-v7:23.0.1'
compile 'com.android.support:preference-v14:23.0.1'
compile 'com.android.support:palette-v7:23.0.1'
compile 'com.android.support:support-v13:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
}
The problem was in apkLib dependency and confuse msg from Gradle.
The one who asked this question could solve this problem this way:
this error appeared to me when I imported some libs that required Google Play services,
I just passed from:
compile 'com.google.android.gms:play-services:6.5.87'
to:compile ('com.google.android.gms:play-services:6.5.87') {
exclude module: 'support-v4'
}
Now it builds okhttp://stackoverflow.com/questions/25384166/multiple-dex-files-define-landroid-support-v4-accessibilityservice-accessibility
My issue
Luckily my issue could be solved using a smiliar approach, just with the latest Google Play Services GCM
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile ('com.google.android.gms:play-services-gcm:8.1.0') {
exclude module: 'support-v4'
}
compile 'joda-time:joda-time:2.8.2'
compile 'com.wefika:flowlayout:0.4.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
compile 'com.makeramen:dragsortadapter:1.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'org.adw.library:discrete-seekbar:1.0.0'
compile 'com.android.support:preference-v7:23.0.1'
compile 'com.android.support:preference-v14:23.0.1'
compile 'com.android.support:palette-v7:23.0.1'
compile 'com.android.support:support-v13:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
}
Keine Kommentare:
Kommentar veröffentlichen