错误:执行失败的任务“:应用程序:transformClassesWithDexForDebug” [英] Error:Execution failed for task ':app:transformClassesWithDexForDebug'

查看:1164
本文介绍了错误:执行失败的任务“:应用程序:transformClassesWithDexForDebug”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误

错误:执行失败的任务:应用程序:transformClassesWithDexForDebug。
  com.android.build.transform.api.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程命令/ usr / lib目录/ JVM / java的8神谕/斌/ java的'非零退出值完成1

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

我的应用程序文件的gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId 'Hidden application ID'
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    lintOptions {
        disable 'InvalidPackage'
    }
    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }
    productFlavors {
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'com.googlecode.libphonenumber:libphonenumber:7.2.1'
    compile 'com.getbase:floatingactionbutton:1.10.1'
    compile 'com.android.support:preference-v7:23.1.1'
}

在调试,如果我设置minifyEnabled为true,然后再编译。但是,那么我就无法调试我的应用程序。

While debugging, if I set minifyEnabled to true, then it compiles. However, then I cannot debug my application.

我检查这个另一个问题:<一href=\"http://stackoverflow.com/questions/33369163/execution-failed-for-task-apptransformclasseswithdexfordebug-while-implement\">Execution失败的任务:应用程序:transformClassesWithDexForDebug'。而谷歌实现登录为Android ,但只有一个答案,并实施它不遗憾的是解决问题。

I checked this other question: Execution failed for task ':app:transformClassesWithDexForDebug' while implementing Google sign in for Android, but there is only one answer and implementing it does not resolve the issue unfortunately.

据我所知,该错误是由于除了太多摇篮依赖造成的,但我可能是错的(我真的希望,因为所有这些包都是非常重要的是错误的!)。

AFAIK, the error is caused due to addition of too many Gradle dependencies, but I may be wrong (I really hope to be wrong because all these packages are really important!).

请帮我解决这个错误。不胜感谢!

Please help me to resolve this error. Much thanks!

推荐答案

尝试

dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
}

我不知道原因。
关于 preDexLibraries 的东西:
https://sites.google.com /a/android.com/tool​​s/tech-docs/new-build-system/tips

据@ lgdroid57:

According to @lgdroid57 :

下面的资源将有助于解释这code:链接(<一个href=\"http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.DexOptions.html\" rel=\"nofollow\">http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.DexOptions.html)房产|说明javaMaxHeapSize |调用DX时,设置-JXmx *值的格式应遵循1024M模式preDexLibraries |。是否pre-DEX库这可以提高增量编译,但干净版本可能会比较慢。

The following resource should help explain what this code does: link(http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.DexOptions.html) Property | Description javaMaxHeapSize | Sets the -JXmx* value when calling dx. Format should follow the 1024M pattern. preDexLibraries | Whether to pre-dex libraries. This can improve incremental builds, but clean builds may be slower.

这篇关于错误:执行失败的任务“:应用程序:transformClassesWithDexForDebug”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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