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

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

问题描述

我试图执行code但我在邮件中的打造的gradle

收到错误信息

 执行失败的任务:应用程序:transformClassesWithDexForDebug。
错误:执行失败的任务:应用程序:transformClassesWithDexForDebug。
com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:过程'命令'C:\\ Program Files文件\\的Java \\ jdk1.7.0_45 \\斌\\ java.exe的'非零退出值2结束

的build.gradle 我的项目(​​应用模块)。

 应用插件:'com.android.application安卓{
    compileSdkVersion 23
    buildToolsVersion23.0.0    defaultConfig {
        的applicationIDcom.paulusworld.drawernavigationtabs
        15的minSdkVersion
        targetSdkVersion 23
    / * multiDexEnabled真* /
    }    buildTypes {
        发布 {
            minifyEnabled假
            proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard的-rules.txt
        }
    }
}依赖{
    编译文件树(导演:'库',包括:['的* .jar'])
    编译文件(库/ Android的支持 - v23.jar')
    编译com.android.support:appcompat-v7:23.1.1
    编译com.android.support:support-v4:23.1.1
}
的gradle建设(项目navigationtab)
buildscript {
    库{
        jcenter()
    }
    依赖{
        类路径'com.android.tools.build:gradle:1.5.0
    }
}allprojects {
    库{
        jcenter()
    }
}


解决方案

具有multiDexEnabled设置为真就可以工作了一个quickfix,但它也隐藏了真正的问题。考虑审查你的应用程序设置,就像你,包括你的项目库,他们可能会被加比你更需要...

对你有你的目录下的内容看,因为你的是的gradle将所有的罐子在那里。而这是什么相较于V4和放大器; V7编译项?

 编译文件(库/ Android的支持 -  v23.jar')

另外,如果您添加应用程序兼容性-V7 您不需要添加支持-V4 的实例。

阅读本节避免了65K限制进一步的细节。

I am trying to execute the code but i'm getting error message in messages gradle build that

Execution failed for  task ':app:transformClassesWithDexForDebug'.
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 'C:\Program Files\Java\jdk1.7.0_45\bin\java.exe'' finished with non-zero exit value 2

build.gradle(app module) of my project is.

  apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        applicationId "com.paulusworld.drawernavigationtabs"
        minSdkVersion 15
        targetSdkVersion 23
    /*    multiDexEnabled true*/
    }

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/android-support-v23.jar')
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
}


build gradle(project navigationtab)


buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

解决方案

Having the 'multiDexEnabled' set to 'true' would be a quickfix that could work, but it would also hide the real problem. Consider reviewing your application setup, like the libraries you're including in your project, they might be adding more than you need...

Have a look on what you have on your libs directory, as your gradle is adding all the jars there. And what's this in comparison to the v4 & v7 compile entries?

compile files('libs/android-support-v23.jar')

Also, if you add the appcompat-v7 you don't need to add the support-v4 for instance.

Read this section Avoiding the 65K Limit for further details.

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

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