错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败。
java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex
我的build.gradle(app)内容如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.example.app"
minSdkVersion 16
targetSdkVersion 27
versionCode 86
versionName "2.86"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
/*repositories {
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
url "https://jitpack.io"
}
}*/
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
implementation fileTree(include: ['*.jar'], dir: 'libs')
enter code here
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.1'
//implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
// implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.android.libraries.places:places:1.1.0'
// implementation 'com.google.android.libraries.places:places-compat:1.1.0'
// implementation 'com.google.android.gms:play-services-places:11.6.0'
// implementation 'com.google.firebase:firebase-database:10.2.1'
implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.squareup.picasso:picasso:2.4.0'
// implementation 'com.android.support:design:27.1.1'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
//implementation 'com.google.android.gms:play-services-location:10.2.1'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.bugsee:bugsee-android:1.8.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'info.hoang8f:android-segmented:1.0.6'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
implementation 'id.zelory:compressor:2.1.0'
// implementation 'com.commit451:PhotoView:1.2.4'
// testCompile 'junit:junit:4.12'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.4.1'
implementation project(':library')
}
我的build.gradle(library)内容如下:
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.library'
apply from: "quality.gradle"
group = 'com.github.eggheadgames'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 13
versionName "1.5.2"
}
/* buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
warningsAsErrors true
disable 'OldTargetApi'
disable 'GradleDependency'
}*/
}
dependencies {
testImplementation 'junit:junit:4.12'
// testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.json:json:20160212'
// implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
}
错误原因很明确,但是我没有两次编译任何库。 谢谢