【问题标题】:Error:Execution failed for task ':app:transformClassesWithDexForDebug' Gradle错误:任务 ':app:transformClassesWithDexForDebug' Gradle 执行失败
【发布时间】:2016-05-24 12:23:15
【问题描述】:

错误:任务 ':app:transformClassesWithDexForDebug' 执行失败。

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1 .7.0_79\bin\java.exe'' 以非零退出值 2 结束

这是我的 gradle 构建

apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.hugo'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.google.peep"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0.1"
    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:support-v13:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:palette-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.jakewharton.timber:timber:4.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.parse.bolts:bolts-tasks:1.3.0'
    compile 'com.parse:parse-android:1.11.0'
    compile 'com.javon.parserecyclerviewadapter:parserecyclerviewadapter:1.0.4'
}

【问题讨论】:

    标签: java android android-gradle-plugin


    【解决方案1】:

    在您的默认配置中添加:multidexEnabled true,然后将此依赖项添加到您的项目 compile 'com.android.support:multidex:1.0

    更多信息请参考此链接http://developer.android.com/intl/pt-br/tools/building/multidex.html#mdex-gradle

    【讨论】:

    • 是的,我确实按照说明进行操作,现在我收到错误消息:任务“:app:transformClassesWithJarMergingForDebug”的执行失败。 > com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/parse/ConnectivityNotifier$ConnectivityListener.class
    • 所以你的项目中可能有两个同名的类。如果您编写了一个名为 ConnectivityListener 的类,请尝试重命名并查看会发生什么。我建议您清理/重建您的项目
    • 错字multiDexEnabled true
    猜你喜欢
    • 2017-09-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-07
    • 2014-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多