I am trying to write code for Android FirebaseUI — Auth in my android project but from last two days, I am getting errors in my current code and don\'t know how to fix it. t
From Firebase doc:
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Bottom position of this line not top (below apply plugin: 'com.android.application').
In my case I've turned on gradle offline mode that's why it could not find out cached files for that version play-service or can not resolve. When I turn it on back to online everything is ok now.
Android Studio ->> File ->> Gradle ->> offline ->> uncheck
Android studio 3.2 Please follow below steps.
1.Invalidate cache and restart option. File->Invalidate/Restart
It will sync libs in next launch.
Change your top level dependency gradle setting
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In my case I already had the google()
repository installed. I was unable to resolve the dependency until I rebooted Android Studio. My guess is it couldn't resolve due to some lingering proxy config from when I had Charles open earlier in the day.
add this in your project level gradle file
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}