关于Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.编译错误

来源:互联网 发布:质量矩阵模版 编辑:程序博客网 时间:2024/05/21 10:41

开发环境: Android studio

gradle编译失败,问题如下:

Error:Execution failed for task ‘:funboxlauncher:transformClassesWithDexForDebug’.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\Program Files\Java\jdk1.7.0_79\bin\java.exe” finished with non-zero exit value 3

这个问题是因为Multidex引起的,解决方式如下:

1、在 build.gradle中,添加如下命令:

// Enabling multidex support.        multiDexEnabled true
dependencies {  compile 'com.android.support:multidex:1.0.0'}

2、Application要继承android.support.multidex.MultiDexApplication

3、在你的 manifest 文件中:

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.android.multidex.myapplication">    <application        ...        android:name="你的Application">        ...    </application></manifest>

更多资料,参考:

http://stackoverflow.com/questions/33717886/errorexecution-failed-for-task-apptransformclasseswithdexfordebug

0 0