Configure Firebase on Android

I cannot configure the updated version of firebase on Android studio. I created a json project file based on firebase and copied it into the project and after copying the lines in gradle:

buildscript { // ... dependencies { // ... classpath 'com.google.gms:google-services:3.0.0' } } apply plugin: 'com.android.application' android { // ... } dependencies { compile 'com.google.firebase:firebase-core:9.0.1' } // ADD THIS AT THE BOTTOM apply plugin: 'com.google.gms.google-services' 

I get the following error:

failed to resolve: compile 'com.google.firebase:firebase-core:9.0.0'

How can i fix this?

+8
android android-studio build.gradle firebase
source share
2 answers

I had the same problem. If you are using Android studio, you should then update the google repository in the SDK Manager.

enter image description here

Below is my build.grade (app)

 apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.3" useLibrary 'org.apache.http.legacy' defaultConfig { applicationId "package name" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" vectorDrawables.useSupportLibrary = true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile 'com.google.firebase:firebase-core:9.0.0' } apply plugin: 'com.google.gms.google-services' 

And this is my build.grade (project)

 buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.0' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } 
+19
source share

Firebase is powered by Google Play services. Therefore, please make sure that you have the following sdk tools and they are updated to synchronize with the library versions of firebase that you are using.

SDK Tools installed for this project

Project level build.gradle file

  // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.google.gms:google-services:3.0.0' } } allprojects { repositories { jcenter() } } 

Module level build.gradle file

 apply plugin: 'com.android.application' android { packagingOptions { exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE-FIREBASE.txt' exclude 'META-INF/NOTICE' } compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.devdeeds.firebaseauth" minSdkVersion 17 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.firebase:firebase-auth:9.2.0' compile 'com.android.support:appcompat-v7:23.3.0' compile 'com.android.support:design:23.3.0' } apply plugin: 'com.google.gms.google-services' 
+1
source share

All Articles