首页 > 解决方案 > 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

}

标签: androidqtandroid-gradle-pluginbuild.gradle

解决方案


因此,我能够通过迁移到 AndroidX 来解决问题,如此处所述https://developer.android.com/jetpack/androidx/migrate。修改必要的文件后,编译错误消失了。


推荐阅读