nick
nick

Reputation: 55

Failed to resolve: com.google.firebase:firebase-core:11.0.0

I've seen this question asked and replies along the lines of re-syncing the project and updating the SDK. I am right at the beginning of a new project and trying to set up authentication with firebase and I'm getting the following errors

Does android studio just hate me?

Error:Failed to resolve: com.google.firebase:firebase-core:11.0.0 Open File
Show in Project Structure dialog Error:Error:line (29)Failed to resolve: com.google.firebase:firebase-auth:11.0.0 Show in File
Show in Project Structure dialog

Upvotes: 4

Views: 5628

Answers (7)

Fahyma
Fahyma

Reputation: 1

for android studio 4.1.2.

  1. first make sure you have installed google play services from SDK manager. Go to Tools on the menu of android studio - SDK manager - SDK Tools if its not installed install it.
  2. connect your app to firebase. On Tools click on firebase, firebase will open a new window, click on analytics. it will direct you to firebase site, from there create a project, it will automatically select your project. 3.when you go back to your project you will see "connected to firebase" 4.so if you run your project and get the error- could not find com. google. firebase 19.3.1 paste this to your project/ build.gradle classpath 'com.google.gms:google-services:4.3.5' on the dependencies- DONT FORGET TO SYNC NOW Then on the app/build.gradle at the bottom/end of the file paste this apply plugin: 'com.google.gms.google-services' 5.Rebuild your project and the run again.

NB/classpath 'com.google.gms:google-services:4.3.5'
apply plugin: 'com.google.gms.google-services'

if it was helpful leave a comment.

Upvotes: 0

ali bagheri
ali bagheri

Reputation: 149

lines order is very importance for the Gradle.

1) buildscript { ext.kotlin_version = '1.2.20'

repositories {
    maven { url "https://maven.google.com" }
    maven { url 'https://plugins.gradle.org/m2/'}
}

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.google.gms:google-services:3.0.0'//3.2.0
    classpath 'com.google.firebase:firebase-plugins:1.0.4'
    classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

and

2)

dependencies {
compile project(':libraries')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//--------------------------------- One Signal-------------------
//compile 'com.onesignal:OneSignal:[3.1.1, 3.3.99]'
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
//-------------------------------------------------------------
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:percent:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}

apply plugin: 'com.google.gms.google-services'

good luck

Upvotes: -2

Iman
Iman

Reputation: 339

Make sure that your project level build.gradle file have these:

 allprojects {
        repositories {
            jcenter()
            mavenLocal()
            maven { url 'https://maven.google.com'  }
        }
    }

Upvotes: -1

nick
nick

Reputation: 55

I was able to resolve this by using 10.0.0

Thanks all for your help

Nick

Upvotes: 1

Darush
Darush

Reputation: 12021

Go to Tools > Android > SDK Manager click on SDK Tools and update the following:

  • Google Repository
  • Android SDK Platform-Tools

Upvotes: 10

Asmaa Shaban
Asmaa Shaban

Reputation: 11

enter image description here

you can only click on AddAnalytics to your app follow this https://firebase.google.com/docs/android/setup

Upvotes: 1

jitendra purohit
jitendra purohit

Reputation: 692

Just goto sdk manager and update google repository.

Upvotes: 4

Related Questions