我在生成apk时遇到以下错误或当我尝试将应用程序部署到设备时,我在删除.gradle和build文件夹后重新启动了工作室但是它没有帮助我尝试了无效缓存并重新启动选项我仍然得到这个错误。
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or -
-debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
构建gradle文件:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.nrs.nsnik.notes"
minSdkVersion 24
targetSdkVersion 26
versionCode 30
versionName "2.9.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
resConfigs "en"
splits {
abi {
enable true
reset()
include 'x86_64', 'x86', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips'
universalApk false
}
}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
ext.versionCodes = ['armeabi': 3, 'armeabi-v7a': 4, 'arm64-v8a': 5, mips:
6, 'x86': 7, 'x86_64': 8]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(OutputFile.ABI)) * 1000 + android.defaultConfig.versionCode
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
implementation ("org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version") {
exclude group: 'org.jetbrains', module: 'annotations'
}
//MULTI DEX
implementation 'com.android.support:multidex:1.0.2'
//CONSTRAINT LAYOUT
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//DESIGN AND SUPPORT LIBRARIES
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:palette-v7:26.1.0'
//FINDBUGS JSR305
implementation 'com.google.code.findbugs:jsr305:3.0.1'
//FIREBASE
implementation 'com.google.firebase:firebase-ads:11.4.0'
implementation 'com.google.android.gms:play-services-ads:11.4.0'
//RX JAVA & ANDROID
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.4'
//RX BINDING
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0'
implementation 'com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:2.0.0'
//CHROME CUSTOM TABS
implementation 'com.android.support:customtabs:26.1.0'
//TIMBER LOGGER
implementation 'com.jakewharton.timber:timber:4.5.1'
//GUAVA
implementation 'com.google.guava:guava:23.0'
//DAGGER 2
implementation 'com.google.dagger:dagger-android:2.11'
implementation 'com.google.dagger:dagger-android-support:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
//BUTTER KNIFE
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//GLIDE
implementation 'com.github.bumptech.glide:glide:4.1.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.1.1'
//ROLL BAR
implementation 'com.rollbar:rollbar-android:0.2.1'
//EVENT BUS
implementation 'org.greenrobot:eventbus:3.0.0'
//AUTO VALUE
compileOnly "com.google.auto.value:auto-value:1.5.1"
annotationProcessor "com.google.auto.value:auto-value:1.5.1"
//AUTO VALUE PARCEL
annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
//LEAK CANARY
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
//BLOCK CANARY
implementation 'com.github.markzhai:blockcanary-android:1.5.0'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
我正在使用android studio 3.0 beta - 6.