尝试执行以下操作:
- ionic cordova platform rm android
- 移除插件
- 清除缓存
- 删除 package-lock.js
- 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
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
尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获取更多日志输出。使用 --scan 运行以获得完整的信息。
获取更多帮助,请访问 https://help.gradle.org
- 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