Build issue - Dex Merge issue

I’m getting issue follow while taking android build.

Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’

Task :app:compileDebugNdk NO-SOURCE
Task :app:compileDebugSources
Task :app:mergeDebugShaders
Task :app:compileDebugShaders
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Task :app:generateDebugAssets
Task :CordovaLib:mergeDebugShaders
Task :CordovaLib:compileDebugShaders
Task :CordovaLib:generateDebugAssets
Task :CordovaLib:packageDebugAssets
Task :app:mergeDebugAssets
Task :app:validateSigningDebug
Task :app:signingConfigWriterDebug
Task :app:transformClassesWithDexBuilderForDebug

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: android.support.v4.app.INotificationSideChannel

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at Adicionar dependências de compilação  |  Android Studio  |  Android Developers.
Program type already present: android.support.v4.app.INotificationSideChannel

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s
35 actionable tasks: 33 executed, 2 up-to-date
/Users/panmoh/Documents/mobile-app/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: /Users/panmoh/Documents/mobile-app/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
D8: Program type already present: android.support.v4.app.INotificationSideChannel

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at Adicionar dependências de compilação  |  Android Studio  |  Android Developers.
Program type already present: android.support.v4.app.INotificationSideChannel

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4s
[ERROR] An error occurred while running subprocess cordova.

    cordova build android exited with exit code 1.
    
    Re-running this command with the --verbose flag may provide more information.

Note : cordova clean android & remove and add android platform also not working.

Task :app:processDebugGoogleServices
Parsing json file: C:\Users\Hello\Desktop\6-19-2019 bnb backup - Copy\platforms\android\app\google-services.json

Task :app:createDebugCompatibleScreenManifests

Task :app:processDebugManifest
C:\Users\Hello\Desktop\6-19-2019 bnb backup - Copy\platforms\android\app\src\main\AndroidManifest.xml:24:9-31:50 Warning:
activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present

Task :app:fabricGenerateResourcesDebug
Task :app:generateDebugResValues
Task :app:generateDebugResources
Task :app:mergeDebugResources
Task :app:processDebugResources

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Task :app:compileDebugJavaWithJavac

Task :app:compileDebugNdk NO-SOURCE
Task :app:compileDebugSources
Task :app:validateSigningDebug
Task :app:signingConfigWriterDebug
Task :app:transformClassesWithDexBuilderForDebug

D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at Adicionar dependências de compilação  |  Android Studio  |  Android Developers.
Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 49s
37 actionable tasks: 35 executed, 2 up-to-date
C:\Users\Hello\Desktop\6-19-2019 bnb backup - Copy\platforms\android\gradlew: Command failed with exit code 1 Error output:
Note: C:\Users\Hello\Desktop\6-19-2019 bnb backup - Copy\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at Adicionar dependências de compilação  |  Android Studio  |  Android Developers.
Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 49s

i m facing the same problem and cordva clean and cordova build also not working for me
please help i m stuck in this issue

@amit96… Add mention your plugin list here… I fixed this issue.

@Mahi1010 How did you fix this issue? I’m running into the same thing. Here are the plugins that we’re using:

com-sarriaroman-photoviewer 1.2.2 "PhotoViewer"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-document-viewer 0.9.11 "SitewaertsDocumentViewer"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-firebase 2.0.5 "Google Firebase Plugin"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.0 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

This issue comes from cordova-plugin-firebase. In my case i used cordova-plugin-fcm and i fixed that some ways.

Follow this thread this issue was reported for plugin of cordova-plugin-firebase.

1 Like

com-badrit-base64 0.2.0 “Base64”
cordova-plugin-android-permissions 1.0.0 “Permissions”
cordova-plugin-androidx 1.0.2 “cordova-plugin-androidx”
cordova-plugin-androidx-adapter 1.0.2 “cordova-plugin-androidx-adapter”
cordova-plugin-camera 4.0.3 “Camera”
cordova-plugin-crop 0.3.1 “CropPlugin”
cordova-plugin-device 2.0.2 “Device”
cordova-plugin-file 6.0.1 “File”
cordova-plugin-file-transfer 1.7.1 “File Transfer”
cordova-plugin-firebase 2.0.5 “Google Firebase Plugin”
cordova-plugin-google-analytics 1.8.6 “Google Universal Analytics Plugin”
cordova-plugin-ionic-keyboard 2.1.3 “cordova-plugin-ionic-keyboard”
cordova-plugin-ionic-webview 1.2.1 “cordova-plugin-ionic-webview”
cordova-plugin-media-capture 3.0.2 “Capture”
cordova-plugin-network-information 2.0.1 “Network Information”
cordova-plugin-splashscreen 5.0.2 “Splashscreen”
cordova-plugin-telerik-imagepicker 2.3.2 “ImagePicker”
cordova-plugin-video-editor 1.1.3 “VideoEditor”
cordova-plugin-whitelist 1.3.3 “Whitelist”
cordova-plugin-zip 3.1.0 “cordova-plugin-zip”

please check this

finally i fix the issue by updation of the android sdk to 28 and the migrated the android into the android x
and install the “cordova-plugin-androidx” plugin
and then
“cordova-plugin-androidx-adapter”

after add the plugin add this line in your gradle properties

android.useAndroidX=true

android.enableJetifier=true

it will resolve your issue

2 Likes

this work for me! Thanks!

Works for me. Thank you!