【发布时间】:2018-05-05 07:54:06
【问题描述】:
我正在尝试运行我的项目,但由于某种原因它给了我这个错误
错误:任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败。 com.android.builder.dexing.DexArchiveMergerException: 无法合并 dex
我看到的解决方案很少,但没有一个对我有帮助。我在这里缺少什么?
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
multiDexEnabled true
applicationId "com.world.bolandian.talent"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-messaging:11.6.0'
implementation 'com.google.firebase:firebase-storage:11.6.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core: 2.2. 2 ', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.beardedhen:androidbootstrap:2.3.2'
compile 'com.github.mukeshsolanki:country-picker-android:1.1.9'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.github.clans:fab:1.6.4'
compile 'com.firebaseui:firebase-ui-auth:3.1.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
-
见Configure your app for multidex。也不要忘记 multidex 支持依赖和设置。
-
这对我来说是 Android Studio 3.0 上的常见错误。除非您达到我怀疑您目前的 65k 方法限制,否则您不需要启用 multidex。当它出现时我要解决这个问题是清理,使用
multiDexEnabled true启用multidex,构建,删除multidex并再次构建 -
我建议您编辑您的问题并发布整个 Gradle 控制台输出,而不仅仅是此错误消息。错误原因的详细信息应在 Gradle 控制台输出中的其他位置。
-
它只是给我那个错误。只有这两行
-
错误:任务 ':app:transformDexArchiveWithExternalLibsDexMergerForDebug' 执行失败。 > java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: 无法合并 dex
标签: android gradle android-gradle-plugin