Android Studio TransformException:错误:任务':app:transformClassesWithDexForDebug'的执行失败 [英] Android Studio TransformException : Error:Execution failed for task ':app:transformClassesWithDexForDebug'

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

问题描述

当我尝试使用 Android Studio 运行应用程序时,出现以下异常:

<块引用>

错误:任务: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.8.0_05\bin\java.exe'' 以非零退出值 2 结束

解决方案

我有同样的问题,经过几个小时的研究,我找到了解决方案.

你应该修复 build.gradle :

android {compileSdkVersion ..buildToolsVersion '...'默认配置{...目标SDK版本..multiDexEnabled true//这一行将解决这个问题}}

<块引用>

如果您的应用中的方法引用数量超过 65K 限制,您的应用可能无法编译.

有关如何执行此操作的信息,请参阅有选择地将 API 编译到您的可执行文件中使用超过 65K 的方法构建应用

I am getting the exception below when I am trying to run the application using Android Studio:

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.8.0_05\bin\java.exe'' finished with non-zero exit value 2

解决方案

I have same issue, after few hour research, i found a solution to fix it.

You should fixed build.gradle :

android {

    compileSdkVersion ..
    buildToolsVersion '...'

    defaultConfig {
       ...
       targetSdkVersion ..
       multiDexEnabled true  // this line will solve this problem
   }
}

If the number of method references in your app exceeds the 65K limit, your app may fail to compile.

For information on how to do this, see Selectively compiling APIs into your executable and Building Apps with Over 65K Methods

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

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