os:OSX 10.11 cordova:5.4.1(也在6.0上试过) 节点:4.2.6 cordova插件使用:crosswalk-project / cordova-plugin-crosswalk-webview(1.5),phonegap / phonegap-plugin-push(1.5.3)和dariosalvi78 / cordova-plugin-health(0.5.3)
运行cordova build android
时收到以下错误
- 出了什么问题:Executi 因任务失败':dexArmv7Debug'。 com.android.ide.common.internal.LoggedErrorException:无法运行命令: /usr/local/Cellar/android-sdk/24.4.1_1/build-tools/23.0.2/dx --dex --no-optimize --output / Users / simon / projects / SproutMobile / platforms / android / build / intermediates / dex / armv7 / debug --input-list = / Users / simon / projects / SproutMobile / platforms / android / build / intermediates / tmp / dex / armv7 / debug / inputList.txt 错误代码: 2 输出:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzpz$zza;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
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)
*
从Multiple dex files define Lcom/google/android/gms/internal/zzau手动将建议的修补程序应用到platforms / android / build.gradle并没有改变任何内容。
非常感谢任何帮助
答案 0 :(得分:0)
使用phonegap / cordova构建后我遇到了类似的问题: com.android.dex.DexException:多个dex文件定义Lcom / google / android / gms / internal / zzsk;
签入build.gradle(模块Android),如果你有2个库应该具有完全相同的版本和不同的版本号。在我的例子中,它是play-services-gms:8.4.0和play-services-location:9.2.1。
这是我更新的build.gradle:
dependencies{
....
//make sure are both same version (8.4.0 or 9.2.1 in my case)
compile 'com.google.android.gms:play-services-gcm:9.2.1'
// this is the one I changed: compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-location:9.2.1' // it was 8.4.0
....
}