失败:构建失败,并出现以下异常:app:multiDexListDebug

我正在努力解决Android Studio Unable to create debug or signed apk的问题。

Task :app:multiDexListDebug FAILED
Task :app:multiDexListDebug in app Finished
:app:multiDexListDebug (Thread[Daemon worker Thread 2,5,main]) completed. Took 2.62 secs.
AAPT2 aapt2-3.5.2-5435860-linux Daemon #0: shutdown

失败:构建失败,并出现异常。

出了什么问题:

Execution failed for task ':app:multiDexListDebug'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$actionFacade
    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: kotlin.StandardKt__SynchronizedKt

场景已尝试:

  • 已启用multidex
  • 添加了依赖项Multidex 2.0.1(android x)
  • 清理和重建项目
  • 从主要项目中排除org.jetbrains.kotlin
  • 使用apiruntimeonly
wuzheng96201 回答:失败:构建失败,并出现以下异常:app:multiDexListDebug

一旦在您的应用程序级别build.gradle中包含以下代码,并检查

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
}
本文链接:https://www.f2er.com/3024221.html

大家都在问