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

旧街凉风 提交于 2020-02-27 07:22:12

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/56688570/program-type-already-present-android-support-v4-os-resultreceivermyresultrecei

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!