Hi , Today I started getting a build error when I try to build android I get the following error
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I’ve looked through previous topics and have tried using the clean cordova commands , removing and re-adding the platform but neither worked. I have checked and android studio and sdks are all up to date. Its probably something obvious but im at a loss. Any suggestions would be greatly appreciated
I am using the command ionic cordova run android --device and ionic cordova build android
the output for both is:
Running app-scripts build: --platform android --target cordova
[18:09:55] build dev started ...
[18:09:55] clean started ...
[18:09:55] clean finished in less than 1 ms
[18:09:55] copy started ...
[18:09:55] deeplinks started ...
[18:09:56] deeplinks finished in 124 ms
[18:09:56] transpile started ...
[18:09:58] transpile finished in 2.27 s
[18:09:58] preprocess started ...
[18:09:58] preprocess finished in less than 1 ms
[18:09:58] webpack started ...
[18:09:58] copy finished in 2.58 s
[18:10:02] webpack finished in 3.89 s
[18:10:02] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[18:10:02] sass finished in 694 ms
[18:10:02] postprocess started ...
[18:10:02] postprocess finished in 15 ms
[18:10:02] lint started ...
[18:10:02] build dev finished in 7.10 s
> cordova build android
Android Studio project detected
ANDROID_HOME=C:\Users\Callum\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_161
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_ezamlnok3y6dos3v4356q2c8p.run(C:\Users\Callum\Documents\v\FinalYearApp\platforms\android\app\build.gradle:144)
:CordovaLib:preBuild
UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript
UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources
UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:preBuild
UP-TO-DATE
:app:preDebugBuild
UP-TO-DATE
:app:compileDebugAidl
UP-TO-DATE
:CordovaLib:packageDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript
UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest
UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources
UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:javaPreCompileDebug
UP-TO-DATE
:app:compileDebugJavaWithJavac
UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:compileDebugSources UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:extractTryWithResourcesSupportJarDebug UP-TO-DATE
:app:transformClassesWithStackFramesFixerForDebug
UP-TO-DATE
:app:transformClassesWithDesugarForDebug
UP-TO-DATE
:app:transformClassesWithDexBuilderForDebug
UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebug
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.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 3s
FAILED
38 actionable tasks: 2 executed, 36 up-to-date
(node:11176) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.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 3s
(node:11176) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Ionic Info Output
@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 : v7.10.0
npm : 4.5.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro`Preformatted text`
Please edit your post, it is not very readable at the moment.
Use the </> button above the input field to format your code, command line output or error message (select the text first, then click the button or wrap it in ``` manually). Check the preview if it looks better. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.
Ive gone through and updated the cordova platform and plugins that were out of date , but I still get the same error.
Running app-scripts build: --platform android --target cordova
[20:12:27] build dev started ...
[20:12:27] clean started ...
[20:12:27] clean finished in 6 ms
[20:12:27] copy started ...
[20:12:27] deeplinks started ...
[20:12:27] deeplinks finished in 151 ms
[20:12:27] transpile started ...
[20:12:29] transpile finished in 2.50 s
[20:12:29] preprocess started ...
[20:12:29] preprocess finished in 1 ms
[20:12:29] webpack started ...
[20:12:29] copy finished in 2.83 s
[20:12:34] webpack finished in 4.33 s
[20:12:34] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[20:12:35] sass finished in 783 ms
[20:12:35] postprocess started ...
[20:12:35] postprocess finished in 16 ms
[20:12:35] lint started ...
[20:12:35] build dev finished in 7.90 s
> cordova build android
Android Studio project detected
ANDROID_HOME=C:\Users\Callum\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_161
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_ezamlnok3y6dos3v4356q2c8p.run(C:\Users\Callum\Documents\v\FinalYearApp\platforms\android\app\build.gradle:144)
:CordovaLib:preBuild
UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl
UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources
UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources
UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac
UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild
UP-TO-DATE
:app:compileDebugAidl
UP-TO-DATE
:CordovaLib:packageDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript
UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest
UP-TO-DATE
:app:splitsDiscoveryTaskDebug
UP-TO-DATE
:app:processDebugResources
UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:javaPreCompileDebug
UP-TO-DATE
:app:compileDebugJavaWithJavac
UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:compileDebugSources UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
UP-TO-DATE
:app:transformClassesWithStackFramesFixerForDebug
UP-TO-DATE
:app:transformClassesWithDesugarForDebug
UP-TO-DATE
:app:transformClassesWithDexBuilderForDebug
UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebug
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.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 3s
FAILED
37 actionable tasks: 1 executed, 36 up-to-date
(node:2996) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.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 3s
(node:2996) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.