android - Qt Android 应用程序错误:com.android.builder.dexing.DexArchiveMergerException
问题描述
因此,当我尝试为 Android 编译我的 Qt 应用程序时,我遇到了这个奇怪的错误。我build.gradle
的实际上(包名称除外)与这里的https://github.com/Larpon/QtFirebaseExample/blob/master/App/platforms/android/build.gradle相同。但是,当我尝试编译时,我会得到一长串错误,开头是:
- 出了什么问题:任务“:transformDexArchiveWithExternalLibsDexMergerForDebug”执行失败。
在 8 秒内构建失败 21 个可操作任务:8 个已执行,13 个最新 com.android.builder.dexing.DexArchiveMergerException:合并 dex 档案时出错:
我在这里阅读了类似的主题,建议启用multiDexEnabled = true
,我已经尝试过并且还尝试过清理我的应用程序,但它不起作用。我也尝试添加implementation 'com.android.support:multidex:1.0.3'
我的依赖项部分,build.gradle
但没有运气。最后我也设置了但没有任何效果。
defaultConfig {
applicationId "packagename" // Used by Firebase auto-config (the google-services.json from Firebase console)
minSdkVersion 23
targetSdkVersion 28
//versionCode 1
//versionName "1.0"
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
// Enabling multidex support.
multiDexEnabled = true
}
解决方案
因此,我能够通过迁移到 AndroidX 来解决问题,如此处所述https://developer.android.com/jetpack/androidx/migrate。修改必要的文件后,编译错误消失了。
推荐阅读
- angular - 在 Typescript Angular 2 中加入数组
- configuration - Azure 边缘部署和配置
- email - 使用来自同一域雷鸟的另一个电子邮件帐户的数字证书签署电子邮件
- google-assistant-sdk - google home 应用程序将 google AIY 语音套件识别为灯
- jmeter - Jmeter-测试计划功能测试模式
- angular - 在 Angular 中处理来自 http 响应的数据
- java - 单击按钮打开新窗口?
- d3.js - D3 ... 加载具有多个 Y 值的字典数组的最佳(推荐)方法
- c - 结构内带有结构参数的函数指针
- google-chrome - Chrome 端口转发不适用于 https 端口