Could not find com.google.gms:google-services:4.0.1
Solution 1
I have the same problem, it seems like Google repo is missing this dependency. I checked the repository and gms folder does not contain any published versions.
So as a quick fix I added another repository, that has it:
repositories {
maven { url 'https://dl.bintray.com/android/android-tools' }
}
EDIT: Since this is only a temporary solution and I consider it as a workaround so I am able to continue developing. I will remove this depencency later when Google repository will contain the depency or we know where they moved it.
Solution 2
Try adding another maven repository to your project gradle file. For example:
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
If that doesn't work, adding the OneSignal gradle plugin, also to the project's gradle, might do the trick (as suggested in this answer).
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
Arafa TechLink
Updated on June 17, 2022Comments
-
Arafa TechLink almost 2 years
Hi i started a new project in android and imported firebase as told in google docs. Everything was perfect in Android studio 3.0.1. Now i update my Android studio to 3.2.1. Now the same code is rebuild and got error that
Could not find com.google.gms:google-services:4.0.1
Log was:
Could not find com.google.gms:google-services:4.0.1. Searched in the following locations: file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar Required by: project :
My Project Level Gradle is:
buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.google.gms:google-services:4.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() google() } } task clean(type: Delete) { delete rootProject.buildDir }
App level Gradle is:
apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "com.arafa.sms" minSdkVersion 21 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.0' implementation 'com.android.support:support-v4:27.1.0' implementation 'com.android.support:animated-vector-drawable:27.1.0' implementation 'com.android.support:support-media-compat:27.1.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.google.code.gson:gson:2.6.2' implementation 'com.squareup.okhttp3:okhttp:3.3.1' implementation 'com.google.firebase:firebase-core:16.0.1' } apply plugin: 'com.google.gms.google-services'
What is the issue here! Please help me out!
-
Łukasz Wiśniewski over 5 yearsworks - for me it's also not finding com.google.firebase:firebase-plugins:1.1.5 anymore, had to add this repo: maven { url 'dl.bintray.com/firebase/gradle' } ¯_(ツ)_/¯
-
tibuurcio over 5 yearsI'm trying to use a library which tries to find com.android.tools.build:gradle:2.2.3 and I'm getting the same could not find message. I believe it's the same problem. Does anyone know a repository from where I could get it?
-
David Sucharda over 5 years@tibuurcio Seems like could use the same one since it contains the library: dl.bintray.com/android/android-tools/com/android/tools/build/…
-
Damiii over 5 years@DavidSucharda is it secure ?! Do google use that ?
-
Deepak Negi over 5 yearsAfter the above change I am getting 'Plugin with id 'com.google.gms.google-services' not found'
-
Peter Haddad over 5 yearsThis
com.android.tools.build:gradle:2.2.3
is inside google maven repogoogle()
@tibuurcio actually its not, its a very old version anyway.. -
David Sucharda over 5 years@Damiii This is a workaround since Google's own repo for some reason does not have the required dependencies. I suggest removing it after google adds it back or we will know where they moved it.
-
tibuurcio over 5 years@DavidSucharda Thank you for the quick response :) It's not working but I'm sure it's something on my end. Will wait to see if the problem resolves itself.
-
David Sucharda over 5 years@tibuurcio seems like it is related to the library you are using and as Peter Haddad mentions it is quite old. Maybe there may be an update for the library which uses newer version?
-
Damiii over 5 yearsIt is fixed now, everybody can remove the temporary solution :)