Android dependency '..' has different version for the compile (..) and runtime (..) classpath

后端 未结 5 409
情深已故
情深已故 2020-12-29 04:44

I migrated to Android Studio 3 and Gradle 4. Then I changed compile to implementation in my build.gradle files. But I get the error:



        
相关标签:
5条回答
  • 2020-12-29 05:17

    this worked for me:

    add following code into your your buildscript

    subprojects {
      project.configurations.all {
         resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                  && !details.requested.name.contains('multidex') ) {
               details.useVersion "version which should be used - in your case 11.6.0"
            }
         }
      }
    }
    

    Best Regards,

    Eddi

    0 讨论(0)
  • 2020-12-29 05:19

    Changing the version of google-services over the top level gradle file fixed the issue for me. It seems the older version is indirectly injecting the firebase-core versions and updating the firebase version explicitly makes the conflict

    classpath 'com.google.gms:google-services:4.0.2' // Just updated the version here.
    
    0 讨论(0)
  • 2020-12-29 05:21

    It appears that, previously, you were implicitly depending on the common-lib module to export Firebase SDKs to your app module. Now that you've changed from "compile" to "implementation", you're no longer exporting those SDKs. So, what's happening now is this: the google-services plugin is adding v9.0.0 of firebase-core to your app module since it no longer sees it present in the visible classpath of your app module.

    You should be able to work around this by manually adding firebase-core to your app module at the correct version. Or, you can continue to export Firebase SDKs from your library module to your app module by switching to an "api" dependency instead of an "implementation" dependency.

    0 讨论(0)
  • 2020-12-29 05:21

    I upgraded compileSdkVersion & targetSdkVersion to 28 and I also faced this same error.

    I upgraded all the dependencies version in app.gradle to 28.0.0 and also in project .gradle file upgraded com.android.tools.build:gradle to 3.3.2

    i.e classpath 'com.android.tools.build:gradle:3.3.2'

    After this project synced successfully

    0 讨论(0)
  • 2020-12-29 05:25
    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                        && !details.requested.name.contains('multidex') ) {
                    details.useVersion "26.1.0"
                }
            }
        }
    }
    

    put this code in your project gradle

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