当我运行ionic cordova build android
在4s内构建失败(节点:5692)UnhandledPromiseRejectionWarning: 未处理的承诺拒绝(拒绝ID:1):错误: / home / bharathi / ionic / hourli / platforms / android / gradlew:命令失败 退出代码1错误输出:FAILURE:生成失败,带有 异常。
- 出了什么问题:任务'执行失败':transformDexArchiveWithExternalLibsDexMergerForDebug'。
com.android.builder.dexing.DexArchiveMergerException:无法合并dex
projects.properties
target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:appcompat-v7:23+
cordova.gradle.include.1=com.synconset.imagepicker/app-ignorelinterrors.gradle
cordova.gradle.include.2=com.synconset.imagepicker/app-androidtarget.gradle
cordova.gradle.include.3=cordova-plugin-badge/app-badge.gradle
cordova.system.library.2=com.facebook.android:facebook-android-sdk:4.+
cordova.system.library.3=com.google.android.gms:play-services-auth:11.6.2
cordova.system.library.4=com.google.android.gms:play-services-identity:11.6.2
cordova.system.library.5=com.android.support:support-v4:+
cordova.gradle.include.4=cordova-plugin-local-notification/app-localnotification.gradle
cordova.system.library.6=com.android.support:support-v4:24.1.1+
cordova.system.library.7=com.android.support:support-v4:26.+
cordova.system.library.8=com.android.support:support-v13:26.+
cordova.system.library.9=me.leolin:ShortcutBadger:1.1.17@aar
cordova.system.library.10=com.google.firebase:firebase-messaging:11.6.2
cordova.gradle.include.5=phonegap-plugin-push/app-push.gradle
的build.gradle
defaultConfig {
multiDexEnabled true
}
我在build.gradle中添加了multiDexEnabled,当我尝试构建时仍然遇到相同的错误。我试过
ionic cordova platform rm android
ionic cordova platform add android
但仍然得到相同的错误
答案 0 :(得分:6)
它发生在我身上。修正:
cordova clean
答案 1 :(得分:0)
尝试修复2天后,我找到了一个解决方案,以我为例,以下插件导致崩溃:cordova-admob-sdk,cordova-plugin-firebase,我在“项目”中手动更改了play-services-ads版本.properties”和“ build.gradle”文件从“ com.google.android.gms:play-services-ads:+”到“ com.google.android.gms:play-services-ads:16.0.0” >