Reputation: 4523
Last time I build successfully but after adding the number of pages I am unable to build, I did search for that error a lot but nothing works for me.For example, added and removed the platform, ionic cordova clean , ionic cordova build etc…
Following Error facing by running-- ionic cordova build android
What went wrong: Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForD ebug’. java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.de xing.DexArchiveMergerException: Unable to merge dex
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 7s
IOnic Info:
cli packages: (C:\Users\ITSERV\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.2 ionic (Ionic CLI) : 3.20.0 global packages:
cordova (Cordova CLI) : 8.0.0 local packages:
@ionic/app-scripts : 3.1.8 Cordova Platforms : android 7.0.0 Ionic Framework : ionic-angular 3.9.2 System:
Node : v6.11.2 npm : 3.10.10 OS : Windows 7
Thanks in advance!
Upvotes: 11
Views: 8493
Reputation: 96
I encountered a similar problem. Installing the plugin helped me
cordova plugin add phonegap-plugin-multidex
Upvotes: -1
Reputation: 23011
Copying this answer from this Github issue comment from Trent Gardner, since anything else didn't work for me:
Fix for the Facebook plugin was to force the Facebook SDK to version 4.25.0.
cordova plugin add cordova-plugin-platform-replace
Then add to your config.xml
<platform name="android"> <replace-string file="project.properties" find="regex:com\.facebook\.android\:facebook-android-sdk\:[\+0-9\.]+" replace="com.facebook.android:facebook-android-sdk:4.25.0" /> </platform>
Finally run
cordova prepare android
Works with the latest 1.9.1 version of cordova-facebook-plugin4
Upvotes: 0
Reputation: 131
I also faced this issued. I solved it via two steps:
Step 1 : cordova clean
Step 2: cordova build
Upvotes: 1
Reputation: 1
Above commands didn't fix my problem.
I change the following line in project.properties in platforms folder
com.google.android.gms:play-services-analytics:11.0.1
to
com.google.android.gms:play-services-analytics:+
and it's fixed
Upvotes: 0
Reputation: 11
I have the same issue
(Unable to merge dex Ionic)
when I created the Ionic app. When I run the app the
BUILD FAILED in 11s 37 actionable tasks: 3 executed
error occurred. First I use the following solution but it doesn't work for me but it work for the other I guess.
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:26.1.0'
}
}
Finally this is what helped me to overcome the issue of failing to build the app.
cordova clean android
ionic cordova build android
ionic cordova run android (To re-launch the app)
Upvotes: 1
Reputation: 4523
I solved this issue by running simply this command and then build the project. don't go into complicated answers like upgrading Gradle or google packages etc..
cordova clean android
ionic cordova build android
Upvotes: 8
Reputation: 1089
I did struggle with this issue for 2 days after i used google maps plugin inside my app and i suppose it is because of google-play-service conflicts and i resolved it by install the latest grade release by using this command. Hope it helps anyone else facing this issue
ionic cordova plugin add cordova-android-play-services-gradle-release
Upvotes: 6