Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

i'm building app with ionic i have add firebase cloud message, everything work fine But today, when i build that show error.

  1. ionic cordova platform rm android
  2. remove plugins
  3. clear & clean cache
  4. remove package-lock.js
  5. npm i 6 ionic cordova platform add android 7 ionic cordova prepare 8 ionic cordova build android

Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED 37 actionable tasks: 7 executed, 30 up-to-date 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 https://developer.android.com/studio/build/dependencies#duplicate_classes. 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 18s /////*/platforms/android/gradlew: Command failed with exit code 1 Error output: 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 https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

like image 234
dessteyu Avatar asked Jun 20 '19 14:06

dessteyu


1 Answers

I had the same issue, and found out it was because of the firebase and googleplus plugins. Finally found a solution that worked for me :

ionic cordova plugin add cordova-plugin-androidx
ionic cordova plugin add cordova-plugin-androidx-adapter

Simply adding these plugins removed any build error.

like image 150
Jeremy Belolo Avatar answered Oct 03 '22 22:10

Jeremy Belolo