我将android-studio 3.0从canary 6更新为beta 3.2,并突然停止抛出多个dex问题。我已根据此链接处理了多个dex配置:https://developer.android.com/studio/build/multidex.html 还更新了构建工具版本到26.0.1,所有firebase和play服务都有相同的版本11.2.0
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define
Lcom/google/android/gms/internal/zzasy;
Error:com.android.dex.DexException: Multiple dex files define
Lcom/google/android/gms/internal/zzasy;
Error: at
com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
Error: at
com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
Error: at
com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
Error: at
com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Error: at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
Error: at
com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
Error: at
com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
Error: at
java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
Error: at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
Error: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
Error: at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
Error: at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzass;
Error:com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzass;
Error: at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
Error: at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
Error: at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
Error: at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Error: at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
Error: at
com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
Error: at
com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
Error: at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
Error: at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
Error: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
Error: at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
Error: at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error:Execution failed for task
':app:transformDexArchiveWithDexMergerForAkashDebug'.
> com.android.build.api.transform.TransformException:
com.android.dex.DexException: Multiple dex files define
Lcom/google/android/gms/internal/zzasy;
答案 0 :(得分:4)
这是由于播放服务依赖项的更新。使用Android Studio 3.0及更高版本,Google依赖项已移至maven.google.com。此外,现在建议您使用模块级依赖项。例如:
implementation 'com.google.android.gms:play-services-places:11.2.0'
有关此检查的更多信息,请this
因此,使用v11.2.0将所有依赖项移动到模块级依赖项 将其添加到build.gradle
repositories {
mavenCentral()
google()
}
将您的compile
语句全部替换为implementation