Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

How to fix “Execution failed for task ‘:app:transformClassesWithDexForRelease’ in Android Studio?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

When we run our app in debug mode in Android Studio, it runs successfully but when we switch to release mode, it fails and throws the error: 

**FAILURE: Build failed with an exception.**

> Execution failed for task ‘:app:transformClassesWithDexForRelease’.

> java.util.concurrent.ExecutionException: org.gradle.process.internal.ExecException: Process ‘command ‘/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java” finished with non-zero exit value 1

So, In this article, we will discuss 6 different methods for fixing the “Execution failed for task ‘:app:transformClassesWithDexForRelease” error in Android Studio.

Method  1

We can fix this error by adding few lines of code in the “” file and also in “gradle” file.

In (The file goes in the project’s root level),

org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m

and, in gradle file, you should do this changes and this will help you in resolving this error.

defaultConfig {

   applicationId “yourProjectPackage”

   minSdkVersion 15

   versionCode 1

   versionName “1.0”

   targetSdkVersion 23

   multiDexEnabled true //important


Method 2

This error “Execution failed for task ‘:app:transformClassesWithDexForRelease” in Android Studio can also be resolved after the removal of jar file from your project which seems that one of the jar files inside your project was using an older version of google play services.

Method 3

If you make multiDexEnabled = true in defaultConfig of the app (Gradle File), you will be able to resolve this error.

defaultConfig {

   minSdkVersion 14

   targetSdkVersion 22

   multiDexEnabled = true


Method 4

We can also resolve this issue by following these steps:

  • Step 1: Open your app’s build.gradle (not the one in the project root).
  • Step 2: Add this Code Snippet.

android {

// snippet

// add this into your existing ‘android’ block

   dexOptions {

   javaMaxHeapSize “4g”


// snip


Note: 4g is 4 Gigabytes and this is a maximum heap size for dex operation.

  • Step 3: Try your build again.

Method 5

Another issue that could be causing this may be some sort of external library you are using, that is referencing a prior version of your dependency. Follow these steps in that case:

  • Go to SDK manager, and install any updates to your dependencies

Method 6

This error “Execution failed for task ‘:app:transformClassesWithDexForRelease’ in Android Studio can also occurred when we upgrading Google play services to 9.0 from 7.5. So, to resolve this–

Change this code snippet:

compile ‘’


compile ‘’

My Personal Notes arrow_drop_up
Last Updated : 24 Mar, 2021
Like Article
Save Article
Similar Reads
Related Tutorials