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

前端 未结 26 3508
野性不改
野性不改 2020-11-27 11:52

android studio was getting build error while build execution with following:

Error:Execution failed for task \':app:transformDexArchiveWithExternalLi

26条回答
  •  鱼传尺愫
    2020-11-27 12:04

    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.

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

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

    • Sync Your project.

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

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

提交回复
热议问题