在android studio中构建应用程序时出现以下错误,为什么会发生这种情况?它与我的proguard规则或dexguard规则有关吗?
当我添加" multiDexEnabled true"在build.gradle文件中,我得到以下错误:
Error:Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException:
java.nio.file.NoSuchFileException:
D:\android\app\build\intermediates\multi-dex\debug\maindexlist.txt
但是,当我添加" multiDexEnabled true"在build.gradle文件中,我得到以下错误:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
的build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
flatDir { dirs 'D:/DexGuard-8.0.17/lib' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.22.1'
classpath ':dexguard:'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'dexguard'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.c.android"
minSdkVersion 19
targetSdkVersion 26
multiDexEnabled true
}
buildTypes {
debug {
proguardFile 'D:/android/app/proguard-project.txt'
proguardFile 'dexguard-project.txt'
}
release {
proguardFile 'D:/android/app/proguard-project.txt'
proguardFile 'dexguard-project.txt'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs'
})
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:design:26.1.0'
compile 'com.google.android.gms:play-services-base:11.4.2'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'
compile 'com.android.support:support-v13:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.specyci:residemenu:1.6'
compile 'com.basgeekball:awesome-validation:2.0'
compile 'com.bahmanm:persianutils_2.10:1.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.6'
compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true
}
compile 'com.google.guava:guava:23.3-android'
}
答案 0 :(得分:0)
您的项目存在一些依赖性问题,请在this answer的帮助下检查依赖性。而且您将知道哪个库存在问题。
答案 1 :(得分:0)
我看不到multidex库
implementation 'com.android.support:multidex:1.0.3'
如果在第一种情况下将其添加到build.gradle文件的依赖项中,则应解决问题
警告:如果目标SDK设置为高于21,则不需要任何
答案 2 :(得分:0)
在“ app /”中删除您的构建文件夹