我关注了这个问题的另外三个资源,但都没有。
我的iOS构建完美,但无论我尝试改变什么,Android都会出现此错误。
以下是错误:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/sakai/Library/Android/sdk/build-tools/23.0.1/dx --dex --no-optimize --output /Users/sakai/mobile/cupomap/platforms/android/build/intermediates/dex/debug --input-list=/Users/sakai/mobile/cupomap/platforms/android/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
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)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 5.343 secs
/Users/sakai/mobile/cupomap/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/sakai/mobile/cupomap/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/sakai/mobile/cupomap/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/sakai/mobile/cupomap/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Users/sakai/mobile/cupomap/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)

许多资源表明它主要是一个具有不同版本的重复支持文件。所以请点击我的插件列表
com.googlemaps.ios 1.9.2 "Google Map iOS SDK for Cordova"
cordova-plugin-console 1.0.1 "Console"
cordova-plugin-device 1.0.1 "Device"
cordova-plugin-device-motion 1.1.1 "Device Motion"
cordova-plugin-device-orientation 1.0.1 "Device Orientation"
cordova-plugin-dialogs 1.1.1 "Notification"
cordova-plugin-geolocation 1.0.1 "Geolocation"
cordova-plugin-splashscreen 2.1.0 "Splashscreen"
cordova-plugin-statusbar 1.0.1 "StatusBar"
cordova-plugin-whitelist 1.0.0 "Whitelist"
phonegap-plugin-push 1.2.2 "PushPlugin"
plugin.google.maps 1.2.9 "phonegap-googlemaps-plugin"
plugin.http.request 1.0.4 "phonegap-http-request"

我已经尝试解决这个问题近一天了。
我感谢任何类型的帮助
答案 0 :(得分:54)
出现同样的问题,将以下行添加到位于platforms / android中的build.gradle文件中为我做了这个。
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
我在行之后复制了它:
apply plugin: 'android'
希望这有帮助。
答案 1 :(得分:2)
这几乎肯定是因为插件冲突。我解决它的方式(我希望你能舒服地坐着)是删除每一个插件,然后逐个添加它们并尝试构建。据我所知,这是诊断这些疾病的唯一真正方法。
通常它依赖于某种类型的Google库(播放服务或位置),所以我说最有可能的罪魁祸首是位置或推送通知中涉及的插件。
答案 2 :(得分:0)
这对我有用:
只需删除" build"平台/ android内的文件夹然后运行cordova build android
。对我来说,它的工作
答案 3 :(得分:0)
对我唯一有用的是更新gradle。然后再次添加平台和插件。 https://stackoverflow.com/a/58754374/9909941