Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio TransformException : Error:Execution failed for task ':app:transformClassesWithDexForDebug'

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

like image 782
Shobharam Piplode Avatar asked Nov 25 '15 11:11

Shobharam Piplode


2 Answers

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

like image 96
Danh DC Avatar answered Oct 09 '22 22:10

Danh DC


in my case using android studio 2.0 preview 4 I suddenly got that problem and adding multiDexEnabled true didn't help, and also clean and rebuilt didn't help.

so the only thing that solved it for me is deleting that file:

YOUR_APP_NAME\app\build\intermediates

and run the application and it works.

like image 26
humazed Avatar answered Oct 09 '22 22:10

humazed