Reputation: 2147
I've checked this answer: https://stackoverflow.com/a/34834772/13519865
It tells us to remove this line
apply plugin: 'com.google.gms.google-services'
Removing the line as asked completes the build, but I can't use Firebase (ofc!), it caused a new error, which tells me to add the line: https://stackoverflow.com/a/40085096/13519865
So, I'm stuck in a loop here. Related code sample added here https://github.com/Cyberavater/A.Reader
Upvotes: 190
Views: 169574
Reputation: 139019
Edit: April 15rd, 2024
The same issue seems to appear with the latest Android Studio Iguana | 2023.2.1 where you need to specify the Gradle version to be 8.3.2
and Google Services 4.4.1
. So here are the working versions:
plugins {
id 'com.android.application' version '8.3.2' apply false
id 'com.android.library' version '8.3.2' apply false
}
dependencies {
classpath 'com.google.gms:google-services:4.4.1'
}
Edit: October 16rd, 2023
The same issue seems to appear with the latest Android Studio Electric Giraffe 2022.3.1 Patch 3 where you need to specify the Gradle version to be 8.1.3
and Google Services 4.4.0
. I have tried to see if the 5.0.0
version works but I got:
Plugin [id: 'com.google.gms.google-services', version: '5.0.0', apply: false] was not found in any of the following sources:
So here are the working versions:
plugins {
id 'com.android.application' version '8.1.3' apply false
id 'com.android.library' version '8.1.3' apply false
}
dependencies {
classpath 'com.google.gms:google-services:4.4.0'
}
Edit: August 15rd, 2023
The same issue seems to appear with the latest Android Studio Electric Giraffe where you need to specify the Gradle version to be 8.1.0
and Google Services 4.3.15
. I have not tested if it's working with 5.0.0
.
plugins {
id 'com.android.application' version '8.1.0' apply false
id 'com.android.library' version '8.1.0' apply false
}
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
}
Edit: March 24rd, 2023
The same issue seems to appear with the latest Android Studio Electric Eel where you need to specify the Gradle version to be 7.4.0
and Google Services 4.3.15
.
plugins {
id 'com.android.application' version '7.4.0' apply false
id 'com.android.library' version '7.4.0' apply false
}
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
}
Edit: January 4th, 2023
I have seen the same issue with the latest Android Studio Dolphin release, where you need to specify the Gradle version to be 7.3.1
and Google Services 4.3.14
.
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
}
dependencies {
classpath 'classpath "com.google.gms:google-services:4.3.14'
}
According to the new Chipmunk update of Android Studio, if you need to use Google Services, you have to add the following lines of code inside your build.gradle (Project) file:
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'com.google.gms.google-services' version '4.3.14' apply false 👈
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And inside your build.gradle (Module) file, the following plugin IDs:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services' 👈
}
Upvotes: 188
Reputation: 47
Go to this link https://developers.google.com/android/guides/google-services-plugin. In android/build.gradle
use the version displayed in that page in place of <latest-version>
in the following.
classpath 'com.google.gms:google-services:<latest-version>'
Upvotes: 1
Reputation: 171
change this line in >> Your project/android/build.gradle
classpath 'com.google.gms:google-services:4.3.10'
to
classpath 'com.google.gms:google-services:4.3.14'
Upvotes: 1
Reputation: 783
I fixed with using latest google services plugin from this link: https://developers.google.com/android/guides/google-services-plugin?hl=tr
right now link provides like this
dependencies {
classpath 'com.google.gms:google-services:4.4.0'
// ...
}
Upvotes: 6
Reputation: 21
This worked for me: In android\build.gradle
dependencies {
...
classpath 'com.google.gms:google-services:4.3.15'
...
}
In android\app\build.gradle
/* on top of file */
apply plugin: 'com.google.gms.google-services'
Upvotes: 1
Reputation: 378
2023: This worked for me.
from
classpath 'com.google.gms:google-services:4.3.10'
To
classpath 'com.google.gms:google-services:4.3.15'
Upvotes: 17
Reputation: 2147
This is most likely a version incompatibility issue. Try to find the compatible google-services Gradle plugin version for your AGP (Android Gradle Plugin) or downgrade your AGP.
The selected answer is updated (almost regularly) with a compatible pair.
Sadly they don't provide a compatibility matrix and I was only able to find this: https://github.com/google/play-services-plugins/tree/master/google-services-plugin#android-gradle-plugin-compatibility
Upvotes: 0
Reputation: 1
In my Flutter project I solved this by:
android/build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.google.gms:google-services:4.3.14'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
on terminal flutter clean
flutter pub get
Upvotes: 0
Reputation: 11
For Cordova-Builds: I was missing the following attribute in the config.xml:
<preference name="GradlePluginGoogleServicesEnabled" value="true" />
In the config.xml you can also set the googleServices version (if you want to apply the answers of the other users in a cordova project without commiting the platforms or plugin directory):
<preference name="GradlePluginGoogleServicesVersion" value="4.3.15" />
Upvotes: 1
Reputation: 56
solved
Replace classpath 'com.google.gms:google-services:4.3.10' with classpath 'com.google.gms:google-services:4.3.14' in android/build.gradle
check the latest gs here : https://developers.google.com/android/guides/google-services-plugin
Upvotes: 2
Reputation: 159
First delete this lines from your build.gradle file and all related files with google play services ( ads , firebase etc ...)
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
//this delete classpath 'com.google.gms:google-services:4.3.5'
//this delete classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Then in your app level build.gradle file delete this lines
You must delete all files related to google play service ...
plugins {
//this delete ====== id 'com.google.gms.google-services'
//this delete ========= id 'com.onesignal.androidsdk.onesignal-gradle-plugin'
// Other plugins here if pre-existing if they related to google play services
}
Upvotes: 0
Reputation: 31
Go to Android/buil.gradle
replace your dependencies-related code with the following code:
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.14'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Upvotes: 0
Reputation: 11
I encountered same error in Android Studio Giraffe 2022.3.1
By opening android/build.gradle and upgrading the build gradle version to 7.3.1 and Google services version to 4.3.15 my app worked.
Upvotes: 1
Reputation: 1
In Flutter -> Android/build.gradle
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.14'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Upvotes: 0
Reputation: 365
In my case, the problem concerned the app/build.gradle where I tend to set three values: (1) compileSdkVersion, (2) minSdkVersion and (3) targetSdkVersion.
On this occasion I found myself setting four values, because a newer version of Android Studio has given me the option, but I was confused, mixing up the "fourth" value with one of the usual three, but it turns out that the fourth value is one that shouldn't be touched, and if you amend it then you'll go around in circles searching for a way to fix the never-ending error messages - hence my encounter with this post.
Example
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
If you see the above within your app/build.gradle file, do not amend it, and if you have amended it, copy what you see here or revert to the default values. Once you set this bit right the error goes away and Flutter runs (if you have set the right settings for the usual three settings).
If this answer helps you, remember to tick it so that it can help others as well.
Upvotes: 0
Reputation: 129
For newbies like myself step by step instructions:
Go to 'android/build.gradle'
Find dependencies {}
Replace there the classpath 'com.google.gms:google-services:4.3.10' with classpath 'com.google.gms:google-services:4.3.14'
Rebuild.
Should work.
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
FAILURE: Build failed with an exception.
Error while evaluating property 'extraGeneratedResDir' of task ':app:mapDebugSourceSetPaths' Failed to calculate the value of task ':app:mapDebugSourceSetPaths' property 'extraGeneratedResDir'. > Querying the mapped value of provider(java.util.Set) before task ':app:processDebugGoogleServices' has completed is not supported
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
BUILD FAILED in 3s Exception: Gradle task assembleDebug failed with exit code 1 Exited
Upvotes: 9
Reputation: 517
Open your android folder then build.gradle and find
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.10'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
and finally change classpath 'com.google.gms:google-services:4.3.10'
to classpath 'com.google.gms:google-services:4.3.15'
and your code should now look like
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.15'
// END: FlutterFire Configuration
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Hopefully this helps
Upvotes: 15
Reputation: 117
In my android/build.gradle for my Flutter project, I had:
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.10'
I updated by changing the lines to
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.google.gms:google-services:4.3.14'
And the errors were resolved. This happened when I moved my Flutter project to a new laptop and the gradle to java versions no longer matched up since I installed the newest version of Flutter.
Upvotes: 4
Reputation: 99
Updating classpath 'com.google.gms:google-services'
to the latest version solved the error for me.
Upvotes: 1
Reputation: 1019
Just update you com.google.gms:google-services
to latest version.
Upvotes: 1
Reputation: 1
First check your build.gradle(project) and paste these code below the plugins and also sync your project.
task clean(type: Delete) {
delete rootProject.buildDir 😊
}
Upvotes: 0
Reputation: 469
I was facing the same issues but after updating the dependency the issues were resolved.
in my project level Gradle file previous it was as below:
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath 'com.google.firebase:perf-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
after updating as below, It was working fine with me.
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
classpath 'com.google.firebase:perf-plugin:1.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Upvotes: 6
Reputation: 1059
change this line in >> android/build.gradle
classpath 'com.google.gms:google-services:4.3.10'
to
classpath 'com.google.gms:google-services:4.3.14'
Upvotes: 96
Reputation: 159
Try with deleting .idea and .gradle folders from root of your app , an then from main app module ... If this doesn't work , then you must clone your project, making new one with same package name ... This is bug in Android Studio Dolphin , and I solved it with cloning with new project with same package name
Upvotes: 0
Reputation: 21
Read this if Alex Mamo's answer does not solve the problem for you.
The new updates of Android Studio prioritize or prefer the settings.gradle file above build.gradle(project) for plugin management. There are two possible solutions.
Solution 1. Update your existing project as follows.
Update your settings.gradle
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
gradlePluginPortal()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven {
url "https://plugins.gradle.org/m2/"}
}
}
rootProject.name = "Your App Name"
include ':app'
Update your build.gradle(project). Use your Gradle version, this example uses version 7.3.0, and google-services: 4.3.14.
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
maven {
url "https://plugins.gradle.org/m2/"
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.14.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false
id 'com.google.gms.google-services' version '4.3.14' apply false
// other plugins in build.gradle(project)
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Add this to your build.gradle(app)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
// other plugins
}
Solution 2. You can create a new project and move all your classes and XML into the new project.
Upvotes: 2
Reputation: 14439
This issue started after updating the com.android.tools.build:gradle
to version 7.3.0
and was fixed for me after updating the com.google.gms:google-services
to version 4.3.14
.
Upvotes: 393