Android Studio 3.0的DexArchiveMergerException [英] DexArchiveMergerException with Android Studio 3.0
问题描述
具有以下build.gradle
详细信息的编译错误:
Having compilation error with the following build.gradle
details :
顶级build.gradle
Top-Level build.gradle
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用级build.gradle
App-Level build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.abc"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
dataBinding {
enabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// Android
implementation 'com.android.support:appcompat-v7:27.+'
implementation 'com.android.support:support-v4:27.+'
implementation 'com.android.support:support-annotations:27.+'
// RxJava & RxAndroid
implementation 'io.reactivex.rxjava2:rxandroid:2.+'
implementation 'io.reactivex.rxjava2:rxjava:2.+'
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar'
//Glide for images
implementation 'com.github.bumptech.glide:glide:4.+'
annotationProcessor 'com.github.bumptech.glide:compiler:4.+'
// Retrofit : Network
implementation 'com.squareup.retrofit2:retrofit:2.+'
implementation 'com.squareup.retrofit2:converter-jackson:2.+'
implementation 'com.google.code.gson:gson:2.+'
// Multidex
implementation 'com.android.support:multidex:1.+'
}
这是错误
错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败. com.android.builder.dexing.DexArchiveMergerException:com.android.tools.r8.errors.CompilationError:程序类型已存在:android.support.v4.app.ActionBarDrawerToggle $ DelegateProvider
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. com.android.builder.dexing.DexArchiveMergerException: com.android.tools.r8.errors.CompilationError: Program type already present: android.support.v4.app.ActionBarDrawerToggle$DelegateProvider
推荐答案
首先,尝试一下
- 清理项目
- 然后重建
如果问题仍然存在
- 使捕获无效并从文件菜单重新启动.
最后如果仍然存在问题,请尝试
and at last if still problem remains try this
删除
\ build
.idea
.gradle
app \ build
delete
\build
.idea
.gradle
app\build
然后重建.希望有帮助;).
then rebuild. hope this help;).
这篇关于Android Studio 3.0的DexArchiveMergerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!