【发布时间】:2018-03-14 22:30:02
【问题描述】:
我在 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,但没有任何效果。
任何帮助将不胜感激!
【问题讨论】:
标签: android kotlin kotlin-android-extensions