Reputation: 1509
Since I upgraded my Google Play Services library to version 16.0.0 my Linter throws the following error:
Incompatible Gradle Versions
../../build.gradle: All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 16.0.1, 16.0.0. Examples include com.google.android.gms:play-services-base:16.0.1 and com.google.android.gms:play-services-location:16.0.0
I displayed all dependencies and saw this:
com.google.android.gms:play-services-location:16.0.0
| | +--- com.google.android.gms:play-services-base:16.0.1
Apparently google play-services-location 16.0.0 has an internal dependency to play-services-base 16.0.1 which causes the error by version mismatch.
In my projects gradle file I already updated the google dependency to:
classpath 'com.google.gms:google-services:4.2.0'
I have to ship the app with locations-version 16.0.0, how can I fix this?
edit: dependencies in my build.gradle:
compile fileTree(include: ['*.jar'], dir: 'libs')
compile libraries.support
compile project(path: ':core')
compile 'com.google.android.gms:play-services-location:16.0.0' {
exclude module: 'support-v4'
}
compile libraries.kotlin
compile libraries.eventbus
// Dagger 2 and Compiler
compile 'com.google.dagger:dagger:2.21'
provided libraries.appcompat
kapt libraries.daggerCompiler
Upvotes: 1
Views: 757
Reputation: 3158
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.google.gms') {
if (requested.name.contains("play-services-location")) {
details.useVersion "16.0.0"
}
if (requested.name.contains("play-services-base")) {
details.useVersion "16.0.0"
}
}
}
}
try this one
Upvotes: 0
Reputation: 511
You can try excluding 16.0.1 from the location services gradle import something like:
implementation 'com.google.android.gms:play-services-base:16.0.0'
implementation ('com.google.android.gms:play-services-location:16.0.0') {
exclude group:'com.google.android.gms', module: 'play-services-base'
}
Upvotes: 3