Reputation: 5025
I am updating Firebase and Google Play services in my Android project. That's how I updated dependencies:
//Play Services
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-measurement-base:16.0.5'
implementation 'com.google.maps.android:android-maps-utils:0.5'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-config:16.1.0'
implementation 'com.onesignal:OneSignal:3.10.3'
When I build my project it fails with following errors:
Failed to resolve: com.google.android.gms:play-services-maps:17.3.4
Failed to resolve: com.google.android.gms:play-services-gcm:17.3.4
Failed to resolve: com.google.android.gms:play-services-location:17.3.4
Failed to resolve: com.google.android.gms:play-services-measurement-base:17.3.4
Failed to resolve: com.google.firebase:firebase-core:17.3.4
Failed to resolve: com.google.firebase:firebase-config:17.3.4
Failed to resolve: com.google.android.gms:play-services-basement:17.3.4
Failed to resolve: com.google.android.gms:play-services-tasks:17.3.4
Failed to resolve: com.google.firebase:firebase-common:17.3.4
Failed to resolve: com.google.firebase:firebase-iid:17.3.4
Failed to resolve: com.google.firebase:firebase-measurement-connector:17.3.4
Failed to resolve: com.google.android.gms:play-services-base:17.3.4
For some reason it requires version 17.3.4 for all libraries. How to make it work?
Root gradle file looks as follows:
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Upvotes: 2
Views: 181
Reputation: 5025
I moved OneSignal plugin to the top of plugins and it helped for some reason.
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
Upvotes: 1
Reputation: 7979
I've experienced issues with OneSignal and dependencies before (e.g. dependency conflict with itself). I'd recommend rolling back to an earlier version of the library, and seeing if it's a recent issue.
Can you also try adding mavenCentral()
as a repository, as it (at least previously) was hosted there.
Upvotes: 1
Reputation: 349
In google libraries for some reason it requires that all the versions are equal so it takes the higher version and try to fetch the same version on all the other libraries.
You need to to downgrade the other libraries and put them all at the same version and it will work.
Upvotes: 0