构建应用程序时出错:app:transformDexArchiveWithDexMergerForDebug [英] Getting error building App: app:transformDexArchiveWithDexMergerForDebug

查看:49
本文介绍了构建应用程序时出错:app:transformDexArchiveWithDexMergerForDebug的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 android studio 中构建应用程序时出现以下错误,为什么会发生这种情况?与我的 proguard 规则或 dexguard 规则有关吗?

I get the following error while building the app in android studio, why this is happening? Is it related to my proguard rules or dexguard rules?

当我在 build.gradle 文件中添加multiDexEnabled true"时,出现以下错误:

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

但是,当我在 build.gradle 文件中添加multiDexEnabled true"时,出现以下错误:

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'
}

推荐答案

删除app/"中的 build 文件夹

Delete your build folder inside "app/"

这篇关于构建应用程序时出错:app:transformDexArchiveWithDexMergerForDebug的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆