Reputation: 1838
I'm trying to coax a number of android libraries to play nicely together but I'm becoming frustrated with the versioning system.
I've managed to get the firebase version of crashlytics working but I cannot currently get this to work well with admob:
in my app 'build.gradle' I have the following dependency section:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.0.5'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.6'
implementation 'com.google.android.gms:play-services-ads:16.0.1'
}
Which produces this error:
Failed to resolve: com.google.android.gms:play-services-ads:16.0.1
'16.0.4' also fails whereas '17.1.1' produces this error:
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:[email protected]
-- Project 'app' depends onto com.google.android.gms:[email protected]
thinking that maybe all of the dependencies need to be '17.1.1' results in gradle not finding 'com.google.firebase:firebase-core:17.1.1'
I doubt I'm alone in finding this version soup somewhat opaque. Is there an easier way to ensure a set of libraries that work well together?
Upvotes: 0
Views: 2111
Reputation: 1285
Add:
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
and in top level gradle file use the latest version of google play services:
classpath 'com.google.gms:google-services:4.0.2'
Note:
You need to add the google() repo in the top level gradle file, as specified in the firebase docs and also it should be before jcenter():
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
Upvotes: 2
Reputation: 80914
Please use the following version:
implementation 'com.google.android.gms:play-services-ads:17.1.1'
Also update the firebase-core library to version 16.0.4
:
implementation 'com.google.firebase:firebase-core:16.0.4'
Upvotes: 1