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

开发环境: 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 文件中:

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

更多资料,参考:

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

你可能感兴趣的:(Android)