错误:任务“:app:transformClassesWithDexForDebug"执行失败.&gt

时间:2023-02-01
本文介绍了错误:任务“:app:transformClassesWithDexForDebug"执行失败.>com.android.build.api.transform.TransformException:..非零退出值 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

After Clean Project -> Rebuild Project my android project I am getting below error

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-oracle/bin/java'' finished with non-zero exit value 3

Gradle :

    apply plugin: 'com.android.application'

    android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.myapplicationname.app"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    useLibrary 'org.apache.http.legacy'

}

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile files('libs/gcm.jar')
    compile 'com.android.support:multidex:1.0.1'
    compile 'org.apache.httpcomponents:httpcore:4.4.4'
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: "httpclient"
    }
    //facebook sdk
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'org.apache.httpcomponents:httpcore:4.4.3'

    compile 'com.paypal.sdk:paypal-android-sdk:2.12.4'
    //facebook sdk
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'

}

I already refer this , this , But I can't got my solution.What I need to do to resolve it.

解决方案

I just update my gradle file like below.This work like charm!!

I added below code in my gradle:

dexOptions {
        javaMaxHeapSize "4g" //specify the heap size for the dex process
        preDexLibraries = false //delete the already predexed libraries
    }

My updated Gradle:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.myapplicationname.app"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
  //====================Add below two line=============
    dexOptions {
        javaMaxHeapSize "4g" //specify the heap size for the dex process
        preDexLibraries = false //delete the already predexed libraries
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    useLibrary 'org.apache.http.legacy'

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile files('libs/gcm.jar')
    compile 'com.android.support:multidex:1.0.1'
    compile 'org.apache.httpcomponents:httpcore:4.4.4'
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: "httpclient"
    }
    //facebook sdk
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'org.apache.httpcomponents:httpcore:4.4.3'

    compile 'com.paypal.sdk:paypal-android-sdk:2.12.4'
    //facebook sdk
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'

}

这篇关于错误:任务“:app:transformClassesWithDexForDebug"执行失败.>com.android.build.api.transform.TransformException:..非零退出值 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:如何将 Gson 附加功能添加到 Android 项目? 下一篇:[[15.0.1,15.0.1]] 的各种其他库正在请求库 com.google.android.gms:play-se

相关文章

最新文章