我在Android Studio中收到此错误:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
使用此应用程序gradle文件:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
buildToolsVersion "26.0.3"
defaultConfig {
applicationId "com.example.android.kotlintest"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:support-v13:$supportVersion"
testCompile 'junit:junit:4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
}
repositories {
mavenCentral()
}
此外,$supportVersion
= '26.+'
我无法弄清楚导致这种情况的配置。我试过干净&重建,我添加了multiDexEnabled true
,但没有任何效果。
非常感谢任何帮助!
答案 0 :(得分:0)
对我来说,这是因为使用了混合版本的依赖项。尝试将它们更改为相同版本..
答案 1 :(得分:0)
您是否尝试过清理构建并再次构建?