颤振构建错误 - 合并 dex 档案
Posted
技术标签:
【中文标题】颤振构建错误 - 合并 dex 档案【英文标题】:flutter build error - merging dex archives 【发布时间】:2019-07-31 09:20:09 【问题描述】:我今天升级了颤振(颤振更新)和软件包(颤振软件包更新),因为我的应用程序没有构建。
这是我得到的输出(在尝试将 sdk 从 27 更改为 28 并清理之后)
感谢您的帮助。
Launching lib\main.dart on in debug mode...
正在初始化渐变... 解决依赖关系... 摇篮任务'assembleDebug'... ****************************************************** ******* 警告:如果此版本的 device_info 或其依赖项与 androidX 不兼容,它将破坏您的 Android 构建。 有关该问题以及如何解决该问题的更多信息,请参阅 h。 此警告会针对所有 Android 构建失败打印。错误的真正根本原因可能是无关的。 ****************************************************** ******* D8:程序类型已经存在:android.support.v4.app.INotificationSideChannel$Stub$Proxy
FAILURE:构建失败并出现异常。
出了什么问题: 任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败。
com.android.builder.dexing.DexArchiveMergerException:合并 dex 档案时出错:C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\271。 jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\272.jar, C:\Users\X\Documents\Projects\git\XX\ app\build\app\intermediates\transforms\dexBuilder\debug\273.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\274.jar , C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\275.jar, C:\Users\X\Documents\Projects\git\XX\app \build\app\intermediates\transforms\dexBuilder\debug\276.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\277.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\278.jar, C:\Users\X\Documents\Projects\git\XX\app\ build\app\intermediates\transforms\dexBuilder\debug\ 279.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\280.jar, C:\Users\X\Documents\Projects\git\ XX\app\build\app\intermediates\transforms\dexBuilder\debug\281.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\282 .jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\283.jar, C:\Users\X\Documents\Projects\git\XX \app\build\app\intermediates\transforms\dexBuilder\debug\284.jar,C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\285。 jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\286.jar, C:\Users\X\Documents\Projects\git\XX\ app\build\app\intermediates\transforms\dexBuilder\debug\287.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\288.jar , C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transfor ms\dexBuilder\debug\289.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\290.jar, C:\Users\X\ Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\291.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms \dexBuilder\debug\292.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\293.jar, C:\Users\X\Documents \Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\294.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\ dexBuilder\debug\295.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\296.jar, C:\Users\X\Documents\ Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\297.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder \debug\298.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\in termediates\transforms\dexBuilder\debug\299.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\300.jar, C:\Users\ X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\301.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates \transforms\dexBuilder\debug\302.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\303.jar, C:\Users\X \Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\304.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\ transforms\dexBuilder\debug\305.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\306.jar, C:\Users\X\ Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\307.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms \dexBuilder\debug\308.jar, C:\Users\X\Documents\Projects\git \XX\app\build\app\intermediates\transforms\dexBuilder\debug\309.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\ 310.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\311.jar, C:\Users\X\Documents\Projects\git\ XX\app\build\app\intermediates\transforms\dexBuilder\debug\312.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\313 .jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\314.jar, C:\Users\X\Documents\Projects\git\XX \app\build\app\intermediates\transforms\dexBuilder\debug\315.jar,C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\316。 jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\317.jar, C:\Users\X\Documents\Projects\git\XX\ app\build\app\intermediates\transforms\dexBuilder\debug\318.jar, C:\Users\X\Do cuments\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\319.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms \dexBuilder\debug\320.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\321.jar, C:\Users\X\Documents \Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\322.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\ dexBuilder\debug\323.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\324.jar, C:\Users\X\Documents\ Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\325.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder \debug\326.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\327.jar, C:\Users\X\Documents\Projects \git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\32 8.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\329.jar, C:\Users\X\Documents\Projects\git\ XX\app\build\app\intermediates\transforms\dexBuilder\debug\330.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\331 .jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\332.jar, C:\Users\X\Documents\Projects\git\XX \app\build\app\intermediates\transforms\dexBuilder\debug\333.jar,C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\334。 jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\335.jar, C:\Users\X\Documents\Projects\git\XX\ app\build\app\intermediates\transforms\dexBuilder\debug\336.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\337.jar , C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms \dexBuilder\debug\338.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\339.jar, C:\Users\X\Documents \Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\340.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\ dexBuilder\debug\341.jar, C:\Users\X\Documents\Projects\git\XX\app\build\app\intermediates\transforms\dexBuilder\debug\342.jar
尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
通过https://help.gradle.org获得更多帮助
在 37 秒内构建失败 完成错误:Gradle 任务 assembleDebug 失败,退出代码为 1
【问题讨论】:
【参考方案1】:Original answerYuri Misyac
-
启用多索引。
打开your flutter project/android/app/build.gradle
并添加以下行。
defaultConfig
...
multiDexEnabled true // Add this line
和
dependencies
...
implementation 'com.android.support:multidex:1.0.3' // Add this line
-
迁移到AndroidX。
打开your flutter project/android/gradle.properties
并添加以下行。
...
android.useAndroidX=true // Add this line
android.enableJetifier=true //Add this line
更多信息:
Original answer (如果它仍然不起作用,请检查此) Enable Multidex Migrating to AndroidX【讨论】:
以上是关于颤振构建错误 - 合并 dex 档案的主要内容,如果未能解决你的问题,请参考以下文章
颤振,Gradle 任务 assembleDebug 失败,退出代码为 1
构建Cordova Android项目导致“com.android.builder.dexing.DexArchiveMergerException:无法合并dex”错误
Flutter google_sign_in 错误:无法合并 dex