简体   繁体   English

无法使用phonegap-plugin-push,cordova-plugin-crosswalk-webview和cordova-plugin-health来构建cordova android

[英]unable to make cordova android build with phonegap-plugin-push, cordova-plugin-crosswalk-webview, and cordova-plugin-health

os: OSX 10.11 cordova: 5.4.1 (also tried on 6.0) node: 4.2.6 cordova plugins used: crosswalk-project/cordova-plugin-crosswalk-webview (1.5), phonegap/phonegap-plugin-push (1.5.3), and dariosalvi78/cordova-plugin-health (0.5.3) 操作系统: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)

when running cordova build android I receive the following error 当运行cordova build android我收到以下错误

  • What went wrong: Executi on failed for task ':dexArmv7Debug'. 出了什么问题:任务':dexArmv7Debug'的执行失败。 com.android.ide.common.internal.LoggedErrorException: Failed to run command: /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 Error Code: 2 Output: com.android.ide.common.internal.LoggedErrorException:无法运行命令:/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/23.0.2/dx --dex --no-optimize- -输出/ 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)

* *

manually applying the suggested fix from Multiple dex files define Lcom/google/android/gms/internal/zzau to platforms/android/build.gradle did not change anything. 多个dex文件中手动应用建议的修复程序, 将Lcom / google / android / gms / internal / zzau定义为platform / android / build.gradle并没有改变。

Any help would be greatly appreciated 任何帮助将不胜感激

I had a similar problem after building using phonegap/cordova: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzsk; 使用phonegap / cordova构建后,我遇到了类似的问题:com.android.dex.DexException:多个dex文件定义了Lcom / google / android / gms / internal / zzsk;

Check in your build.gradle(module Android), if you have 2 libraries that should have the exact same version with different version numbers. 检入您的build.gradle(Android模块),是否有2个库应具有完全相同的版本,但版本号不同。 In my case it was play-services-gms:8.4.0 and play-services-location:9.2.1. 在我的情况下,它是play-services-gms:8.4.0和play-services-location:9.2.1。

Here is my updated build.gradle: 这是我更新的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
....
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM