Error:Execution failed for task ‘:Application:transformClassesWithDexFor

Error:Execution failed for task ':Application:transformClassesWithDexForMyFlavorName'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

I had this error after updating the project to the latest Build Tools 23.0.0. After spending some hours on google to find a solution without any success, I tried to deactivate the Instant Run option from Preferences. And when I ran the app, it worked!

This is not really a solution, but if you get this error at least you can run your app if you uncheck “Enable Instant Run to swap code/resource on deploy (default enabled) .

Menu