I have created a firebase project and it says I have to modify the core version to 12 according to the picture
The default code is 9.6.1. So, I changed that number to 12.0.1
compile 'com.google.firebase:firebase-core:12.0.1'
However, the sync failed with the following error
Failed to resolve: com.google.firebase:firebase-core:12.0.1
What should I do?
Update the gms plugin:
classpath 'com.google.gms:google-services:4.0.0' // google-services plugin
and the firebase lib:
implementation 'com.google.firebase:firebase-core:16.0.0'
Also add google maven to your build.gradle file:
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
jcenter()
maven { url "https://jitpack.io" }
}
}
com.google.firebase:firebase-core:12.0.1 is old version already.
You can try version 15.0.0 or as Levi Albuquerque said 16.0.0
However just to remind you that if you implement more than one same kind of library, they should be always in the same version to avoid any syncing error.
Example
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-storage:15.0.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
All are same version 15.0.0
You need to add the google() maven inside your allProjects block in your project build.gradle like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
...
}
}
repositories {
...
}
// You need to add the google maven in this block.
allprojects {
repositories {
jcenter()
google()
}
}
For avoid further errors in grandle beacause of a bug try to use:
classpath 'com.google.gms:google-services:3.2.1'
And for firebase use what you need from below:
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-analytics:15.0.2'
implementation 'com.google.firebase:firebase-appindexing:15.0.1'
implementation 'com.google.firebase:firebase-auth:15.1.0'
implementation 'com.google.firebase:firebase-firestore:16.0.0'
implementation 'com.google.firebase:firebase-functions:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-storage:15.0.2'
implementation 'com.google.firebase:firebase-crash:15.0.2'
implementation 'com.google.firebase:firebase-invites:15.0.1'
implementation 'com.google.firebase:firebase-perf:15.2.0'
implementation 'com.google.firebase:firebase-database:15.0.1'
implementation 'com.google.firebase:firebase-config:15.0.2'
If you using gogle play-services in your grandle set version to 15.0.0 like below example:
implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-places:15.0.0'
implementation 'com.google.android.gms:play-services-gcm:15.0.0'
I hope this will help you =)
Related
So I am posting this after much research:
Android Studio build.gradle warning message
Still getting warning : Configuration 'compile' is obsolete and has been replaced with 'implementation'
As many of the solutions suggested,I upgraded my google-services version to 3.2.0.
Still the warning is coming up.
N.B. My project is using a lot of libraries:
Here is project level build.gradle:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.3'
//classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.2.0'
classpath 'io.fabric.tools:gradle:1.22.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com'
}
}
}
Here are all the libraries in app level build.gradle
dependencies {
implementation "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
implementation "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION"
implementation "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
implementation "com.android.support:gridlayout-v7:$SUPPORT_LIBRARY_VERSION"
implementation "com.android.support:support-v4:$SUPPORT_LIBRARY_VERSION"
implementation "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"
implementation "com.android.support:support-v13:$SUPPORT_LIBRARY_VERSION"
implementation "com.android.support:customtabs:$SUPPORT_LIBRARY_VERSION"
implementation "com.android.support:multidex:$MULTIDEX_VERSION"
implementation("com.bottlerocketstudios:barcode:$BARCODE_VERSION#aar") {
transitive = true;
}
implementation "com.bottlerocketstudios:javalockboxlib:$JAVALOCKBOXLIB_VERSION"
implementation "com.bottlerocketstudios:vault:$VAULT_VERSION"
implementation "com.github.bumptech.glide:glide:$GLIDE_VERSION"
implementation "com.github.bumptech.glide:okhttp3-integration:$GLIDE_OKHTTP_VERSION#aar"
implementation "com.squareup.okhttp3:logging-interceptor:$OKHTTP_LOGGER_VERSION"
implementation "com.facebook.android:facebook-android-sdk:$FACEBOOK_SDK_VERSION"
implementation "com.google.android.gms:play-services-auth:$PLAY_SERVICES_VERSION"
implementation "com.google.android.gms:play-services-gcm:$PLAY_SERVICES_VERSION"
implementation "com.google.android.gms:play-services-maps:$PLAY_SERVICES_VERSION"
implementation "com.google.android.gms:play-services-location:$PLAY_SERVICES_VERSION"
implementation "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
implementation "com.jakewharton.rxbinding:rxbinding:$RX_BINDING_VERSION"
implementation "com.jakewharton.rxbinding:rxbinding-support-v4:$RX_BINDING_VERSION"
implementation "com.jakewharton.rxbinding:rxbinding-appcompat-v7:$RX_BINDING_VERSION"
implementation "com.jakewharton.rxbinding:rxbinding-design:$RX_BINDING_VERSION"
implementation "com.jakewharton.rxbinding:rxbinding-recyclerview-v7:$RX_BINDING_VERSION"
implementation "com.jakewharton.threetenabp:threetenabp:$THREETENABP_VERSION"
implementation "com.jakewharton.timber:timber:$TIMBER_VERSION"
implementation "com.jakewharton:process-phoenix:$PROCESS_PHEONIX_VERSION"
annotationProcessor "com.squareup.dagger:dagger-compiler:$DAGGER_VERSION"
implementation "com.squareup.dagger:dagger:$DAGGER_VERSION"
implementation "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
implementation "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION"
implementation "com.f2prateek.rx.preferences:rx-preferences:$RX_PREFERENCES_VERSION"
implementation "com.trello:rxlifecycle:$RX_LIFECYCLE_VERSION"
implementation "com.trello:rxlifecycle-components:$RX_LIFECYCLE_VERSION"
implementation "io.reactivex:rxjava:$RX_JAVA_VERSION"
implementation "io.reactivex:rxandroid:$RX_ANDROID_VERSION"
implementation "pl.charmas.android:android-reactive-location:$REACTIVE_LOCATION_VERSION#aar"
implementation("com.crashlytics.sdk.android:crashlytics:$CRASHLYTICS_VERSION#aar") {
transitive = true;
}
implementation "com.contentful.java:java-sdk:$CONTENTFUL_JAVA_SDK_VERSION"
implementation "uk.co.chrisjenx:calligraphy:$CALLIGRAPHY_VERSION"
implementation "com.flurry.android:analytics:$FLURRY_ANALYTICS_VERSION"
implementation 'org.jsoup:jsoup:1.11.1'
testImplementation "junit:junit:$JUNIT_VERSION"
}
Here are some important library version I am using :
OKHTTP_VERSION=3.8.1
RX_PREFERENCES_VERSION=1.0.0
PLAY_SERVICES_VERSION=15.0.1
BARCODE_VERSION=1.0.3
CONTENTFUL_JAVA_SDK_VERSION=7.5.0
BRFONTVIEW_VERSION=1.0.0
JUNIT_VERSION=4.12
BUTTERKNIFE_VERSION=7.0.1
DAGGER_VERSION=1.2.2
RX_ANDROID_VERSION=1.0.1
RX_JAVA_VERSION=1.0.14
JAVALOCKBOXLIB_VERSION=1.0.0
RX_BINDING_VERSION=0.3.0
CALLIGRAPHY_VERSION=2.1.0
SUPPORT_LIBRARY_VERSION=28.0.0-beta01
RX_LIFECYCLE_VERSION=0.2.0
REACTIVE_LOCATION_VERSION=0.8
RETROFIT_VERSION=2.3.0
CRASHLYTICS_VERSION=2.6.2
FACEBOOK_SDK_VERSION=4.23.0
The warning I am getting:
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Configuration 'debugCompile' is obsolete and has been replaced with 'debugImplementation' and 'debugApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Any idea which one is causing the problem.
Just replace:
compile with implementation
testCompile with testImplementation
debugCompile with debugImplementation
androidTestCompile with androidTestImplementation
compileOnly is still valid. It was added in 3.0 to replace provided and not compile.
Changes with Gradle 3.0 is officially announced at GoogleIO17.
The compile configuration is now deprecated and should be replaced by implementation or api
Check out Gradle Documentation here
Warning you are getting is due to the libraries you have imported are you using compile keyword in the gardle.
The problem is with jakewharton hugo plugin which I was using in the app
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
Relevant link:
https://github.com/JakeWharton/hugo/issues/156
With the hot key "CTRL + Shift + F" try to search for "compile" keyword.If there is no modification left, please go to file -> Invalidate Caches/Restart.These error messages will be gone.
just replace compile-->implementation in app module, except compileSdkVersion in app module
The solution is to upgrade 'com.google.gms:google-services:3.1.0' to 'com.google.gms:google-services:4.0.1'
I might have some versions' issue I guess? I was using
implementation 'com.google.firebase:firebase-messaging:15.0.2'
Everything works fine, now I want to add RealtimeDatabase
The Assistant of Android Studio suggested :
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-database:11.8.0'
Official Guide suggest
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
Both resulting : Please fix the version conflict either by updating the version of the google-services plugin ... or updating the version of com.google.android.gms to 15.0.2.
I know I might have to align their version, but I got
Could not find com.google.firebase:firebase-messaging:16.0.1.
or
Could not find com.google.firebase:firebase-database:15.0.2.
// If I use All official latest
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
Could not find com.google.firebase:firebase-core:17.0.0.
So how can I put them together?
Official site :
Getting a "Could not find" error? Make sure you have added the Google maven respository to your root build.gradle
But I did. (Did I?) Here is my app.gradle
buildscript {
ext.kotlin_version = '1.2.30'
repositories {
google()
jcenter()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.10.1'
classpath 'com.android.tools.build:gradle:3.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
ext {
roomVersion = '1.0.0'
archLifecycleVersion = '1.1.0'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Change this:
classpath 'com.google.gms:google-services:3.1.1'
into this:
classpath 'com.google.gms:google-services:4.0.1'
And use the following dependencies:
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
More info here: Firebase Release notes
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-invites:16.0.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.0'
Above are the dependencies which I have added according to my requirement.
Following is the google play service dependency which I am using.
- implementation 'com.google.android.gms:play-services:12.0.1'
I have also added the 'apply plugin' statement at the end
- apply plugin: 'com.google.gms.google-services'
Please help me out to solve the error!
Are you importing google services in your build.gradle(root level)?
build.gradle root level
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
google() // Google's Maven repository
}
}
build.gradle app level
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
implementation 'com.google.android.gms:play-services:12.0.1'
// ...
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-invites:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.1'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
After update gradle to latest dependencies contain firebase and play services:
Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Failed to resolve: play-services-base
Open File
Failed to resolve: play-services-tasks
Open File
Failed to resolve: play-services-stats
Open File
Failed to resolve: play-services-ads-identifier
Open File
Failed to resolve: play-services-basement
Open File
build.gradle(app)
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
How can I resolve?
I resolved issue.
This is solution
1.add google() before jcenter()
2.exclude group:"com.google.android.gms" in facebook sdk dependencies
My code
Gradle :
buildscript {
repositories {
google()
jcenter()
}
// something here ...
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath "io.realm:realm-gradle-plugin:3.1.1"
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And Myapp/gradle :
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
jcenter()
}
dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0#aar') {
transitive = true
}
implementation ('com.facebook.android:account-kit-sdk:4.28.0'){
exclude group:"com.google.android.gms"
}
implementation 'com.facebook.android:facebook-android-sdk:4.32.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.9.4'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.android.support:multidex:1.0.3'
implementation files('libs/glide-3.8.0.jar')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.squareup.okhttp:okhttp-urlconnection:2.3.0') {
exclude group: 'com.squareup.okhttp', module: 'okhttp'
}
implementation('com.squareup.okhttp:okhttp:2.3.0') {
exclude group: 'com.squareup.okio', module: 'okio'
}
implementation 'me.relex:circleindicator:1.2.2#aar'
implementation 'com.android.support:exifinterface:27.1.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
}
apply plugin: 'com.google.gms.google-services'
I have the same problem and resolved by this:
In Gradle (project), just change the position of google() before jcenter(), and Sync and the error is gone.
repositories {
google()
jcenter()
}
And here is the explanation. Someone had the brilliant idea of uploading to JCenter only the pom definition for com.google.android.gms:play-services-basement:15.0.1 meaning that if JCenter was your first option, it would find the POM file and would attempt to download the AAR from the same location, but it hasn't been upload there. Switching the repositories order with google() now first, it will find both the POM and AAR correctly on Google's repository.
Running gradle app:build from command line would tell you what Android Studio doesn't:
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar
You can see the artifact on JCenter's website, it only contains the POM.
https://bintray.com/bintray/jcenter/com.google.android.gms%3Aplay-services-basement#files/com%2Fgoogle%2Fandroid%2Fgms%2Fplay-services-basement%2F15.0.1
While Google repository has the complete set:
https://maven.google.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.pom
https://maven.google.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar
I am not able to use GoogleSignIn(com.google.android.gms.auth.api.signin.GoogleSignIn
) and GoogleSignInClient(com.google.android.gms.auth.api.signin.GoogleSignInClient
) while implementing Google Sign In in Android Studio while I can access other classes in App like
com.google.android.gms.auth.api.signin.GoogleSignInAccount;
com.google.android.gms.auth.api.signin.GoogleSignInOptions;
com.google.android.gms.common.SignInButton;
A strip down version of my build.gradle(app) file is as follow
android {
}
dependencies {
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-gmail:v1-rev72-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.google.gms:google-services:3.1.2'
}
apply plugin: 'com.google.gms.google-services'
and my build.gradle(package) is
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.2'
}
}
Any help would be appreciated
add this to your app-level dependency
compile 'com.google.android.gms:play-services-auth:12.0.1'
I was having the same issue
GoogleSignIn and GoogleSignInClient were introduced in version Google Play services SDK version 11.6. In older versions GoogleApiClient was used.
So try changing the compile 'com.google.android.gms:play-services-auth:11.4.2' to 'com.google.android.gms:play-services-auth:12.0.1' in dependencies
dependencies
{
compile 'com.google.android.gms:play-services-auth:12.0.1'
}
For me I was applying a plugin for the google play services in my app's build.gradle:
apply plugin: 'com.google.gms.google-services'
along with that in my Project's Build.gradle I had google services.
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:3.1.2' // <== this guy
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
I remember I added them with some compiling issues. But apparently I didn't need them.
By removing them I found there were no more issues with the gms versions.
EDIT
So removing solved my issue initially, but gave me issues later with google sign in. adding the apply plugin: 'com.google.gms.google-services' to the bottom of my projects gradle instead of at the top did actually solve it.
In the build.gradle Module script, I had to add these two dependencies, then "Sync Now" and issue resolved for me.
dependencies {
// Your own command lines
//...
compile 'com.google.android.gms:play-services-drive:11.8.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
}
Can't you use any newer version? e.g. 11.6.0.
Try to update your Google Repository as well.
(Tools->Android->SDK Manager->SDK Tools under Support Repository)
Add this line in build.gradle module file under dependencies.
implementation 'com.google.firebase:firebase-auth:21.0.1'
For example:
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-database:20.0.2'
implementation 'com.google.android.gms:play-services-auth:20.2.0'
implementation 'com.google.firebase:firebase-firestore:24.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.3.5'
implementation 'androidx.navigation:navigation-ui:2.3.5'
implementation 'de.hdodenhof:circleimageview:3.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}