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

前端 未结 26 3479
野性不改
野性不改 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:20

    Resolution:

    Refer to this link: As there are various options to shut the warning off depending on the minSdkVersion, it is set below 20:

     android {
         defaultConfig {
             ...
             minSdkVersion 15 
             targetSdkVersion 26
             multiDexEnabled true
         }
         ... }
    
     dependencies {   compile 'com.android.support:multidex:1.0.3' }
    

    If you have a minSdkVersion greater than 20 in your build.gradle set use the following to shut down the warning:

      android {
          defaultConfig {
              ...
              minSdkVersion 21 
              targetSdkVersion 26
              multiDexEnabled true
          }
          ... }
    

    Update dependencies as follows:

         dependencies {
            implementation 'com.android.support:multidex:1.0.3'
         }
    

    Again the only difference is the keywords in dependencies:

    minSdkVersion below 20: use compile

    minSdkVersion above 20: use implementation

    1. I hope this was helpful, please upvote if it solved your issue, Thank you for your time.
    2. Also for more info, on why this occurs, please read the first paragraph in the link, it will explain thoroughly why? and what does this warning mean.

提交回复
热议问题