Android Studio 3.0 Execution failed for task: unable to merge dex Android Studio 3.0 Execution failed for task: unable to merge dex android android

Android Studio 3.0 Execution failed for task: unable to merge dex


For Cordova based project, run cordova clean android before build again, as @mkimmet suggested.


This error happens when you add an external library which may not be compatible with your compileSdkVersion .

Be careful when you are adding an external library.

I spent 2 days on this problem and finally it got solved following these steps.

  • Make sure all your support libraries are same as compileSdkVersion of your build.gradle(Module:app) in my case it is 26. enter image description here

  • In your defaultConfig category type multiDexEnabled true. This is the important part. multiDexEnabled True image

  • Go to File | Settings | Build, Execution, Deployment | Instant Run and try to Enable/Disable Instant Run to hot swap... and click okay Enable Instant Run to Hot swap... Image

  • Sync Your project.

  • Lastly, Go to Build | click on Rebuild Project.

  • Note: Rebuild Project first cleans and then builds the project.


Try to add this in gradle

    android {      defaultConfig {        multiDexEnabled true        }   }