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

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

    The easiest way to avoid suck kind of error is:

    -Change library combilesdkversion as same as your app compilesdkversion

    -Change library's supportLibrary version as same as your build.gradle(app)

    0 讨论(0)
  • 2020-11-27 12:18

    In my case changing firebase library version from 2.6.0 to 2.4.2 fixed the issue

    0 讨论(0)
  • 2020-11-27 12:18

    I had this when requested SDK version didn't match the dependencies. You can click the line highlighted and fix this clicking the red light bulb. No need to find the actual version, just let the IDE figure it out for you. And add google repo to maven config.

    0 讨论(0)
  • 2020-11-27 12:19

    I Have Done and fixed this issue by just doing this jobs in my code

    Open ->build.gradle Change value from

    compile 'com.google.code.gson:gson:2.6.1'
    

    to

    compile 'com.google.code.gson:gson:2.8.2'
    
    0 讨论(0)
  • 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.
    0 讨论(0)
  • 2020-11-27 12:20

    Simply try doing a "Build -> Clean Project". That solved the problem for me.

    0 讨论(0)
提交回复
热议问题