Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task
H

26

180

I've checked this answer: https://mcmap.net/q/137851/-gradle-error-execution-failed-for-task-39-app-processdebuggoogleservices-39

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://mcmap.net/q/92271/-default-firebaseapp-is-not-initialized

So, I'm stuck in a loop here. Related code sample added here https://github.com/Cyberavater/A.Reader

Handmade answered 13/5, 2022 at 4:28 Comment(1)
Those are some kind of old answers. Please check this answer, it might help. – Haily
H
175

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' πŸ‘ˆ
}
Haily answered 13/5, 2022 at 7:40 Comment(22)
Hello, it seems the is a problem still holds. When I used version 4.3.0 following here #70883809 it was working, but using version 4.3.10 am having the same issue. – Handmade
Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task ':app:mapDebugSourceSetPaths' Caused by: org.gradle.api.InvalidUserCodeException: Querying the mapped value of provider(interface java.util.Set) before task ':app:processDebugGoogleServices' has completed is not supported – Handmade
Try to use the latest 7.2.0 for Gradle or downgrade it to 4.3.0. – Haily
Yes, you are right, Changing it to "7.2.0" worked, Thanks! but isn't '7.4.0-alpha01' more latest? (already latest as it was already '7.4.0-alpha01' by default). – Handmade
Yes, but I prefer to work with stable versions. It's up to you to decide if you want to use that one, or not. – Haily
This did not help me and in fact sent me down another rabbit hole of build errors. Roberto Leinardi answer should be accepted as it worked like a charm. So it appears to be gradle and GMS compatibility issue. – Willawillabella
@AlexMamo I can up vote it if you remove the 2nd half of the plugins and clean task portion from your answer. I do not believe they are related to the issue. The reason is my code already had plugin definition and the cleanup task even before the AS upgrade. The only thing that made any difference was version upgrade. Thanks! – Willawillabella
@MGDeveloper I don't understand what you mean by "the 2nd half". Please edit my answer, to understand it more clearly. There is an edit button right under it. – Haily
If anyone gets this issue in future. This is clearly a version mismatch issue. Try by upgrading version (gms,gradle build) to the most compatible or try by downgrading build.gradle version to the original state and rest to the latest. This worked for me magically. However if you can figure out technically this is a version mismatch issue. – Apical
It's enough if you just set 4.3.15 as google-services! – Lalapalooza
Still failing in Android Studio Giraffe – Distracted
@HardikMehta Are you using Gradle version 8.1.0 and Google Services 4.3.15 and still fails? I doubt it, as I checked that personally. – Haily
Don't know fails for me Gradle version 8.1.0 and Google Services 4.3.15 if i degrade Gradle version to 7.4 then works fine – Distracted
Thanks for this, I only needed to edit the Google services to 4.3.15 – Congruity
@AlexMamo where to add plugins { id 'com.android.application' version '8.1.0' apply false id 'com.android.library' version '8.1.0' apply false } in gradle file ?? – Fatidic
@Fatidic Inside build.gradle (Project) file. – Haily
@AlexMamo can you please mention that where I should place both ? – Fatidic
buildscript { repositories { mavenCentral() google() } dependencies { classpath 'com.android.tools.build:gradle:8.1.3' classpath 'com.google.gms:google-services:4.3.14' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenCentral() google() } } tasks.register('clean', Delete) { delete rootProject.buildDir } – Fatidic
@Fatidic It's hard to read your unformatted code in the comment. Please post a new question, here on StackOverflow, using its own MCVE, so I and other Firebase developers can help you. – Haily
Agreed, this fixed it for me. I previously used the old Firebase authentication method (using Json). After updating my app to the latest flutter + firebase versions I had to authenticate using Flutterfire instead (which then led to the "missing GOOGLE AD_ID" issues), and THEN I had to follow this: https://mcmap.net/q/136217/-execution-failed-for-task-39-app-mapdebugsourcesetpaths-39-gt-error-while-evaluating-property-39-extrageneratedresdir-39-of-task to get it to export without any other errors. Now I genuinely don't know what I need to take out and leave in the gradle.build file, so both varients have been left in there. But it works. – Plasticity
@Plasticity Good to hear that, Delmontee. – Haily
Thanks! Just needed Google Services to go up to 4.4.0, and didn't need gradle version or AGP version (both till 7+) and this worked for me (finally!) on Android Studio Hedgehog – Decoupage
P
353

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.

Pinta answered 19/9, 2022 at 14:3 Comment(4)
Thanks @Robert This answer fixed the issue. Upgraded Android Studio to Android Studio Electric Eel | 2022.1.1 Patch 1 and Gradle to 7.4.1. 'com.google.gms:google-services:4.3.14' classpath in build.gradle fixed the issue. – Favor
Same for me. Going from 4.3.10 tot 4.3.14 fixed it for me. – Subgroup
Agreed, this fixed it for me. I previously used the old Firebase authentication method (using Json). After updating my app to the latest flutter + firebase versions I had to authenticate using Flutterfire instead (which then led to some "missing GOOGLE AD_ID" issues), and THEN I had to follow the information above to get it to export without the mentioned error. Now I genuinely don't know what I need to take out and leave in the gradle.build file, so both varients have been left in there. – Plasticity
2024 and this still worked and fixed "E/FA ( 5048): Missing google_app_id. Firebase Analytics disabled. See https " – Garth
H
175

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' πŸ‘ˆ
}
Haily answered 13/5, 2022 at 7:40 Comment(22)
Hello, it seems the is a problem still holds. When I used version 4.3.0 following here #70883809 it was working, but using version 4.3.10 am having the same issue. – Handmade
Execution failed for task ':app:mapDebugSourceSetPaths'. > Error while evaluating property 'extraGeneratedResDir' of task ':app:mapDebugSourceSetPaths' Caused by: org.gradle.api.InvalidUserCodeException: Querying the mapped value of provider(interface java.util.Set) before task ':app:processDebugGoogleServices' has completed is not supported – Handmade
Try to use the latest 7.2.0 for Gradle or downgrade it to 4.3.0. – Haily
Yes, you are right, Changing it to "7.2.0" worked, Thanks! but isn't '7.4.0-alpha01' more latest? (already latest as it was already '7.4.0-alpha01' by default). – Handmade
Yes, but I prefer to work with stable versions. It's up to you to decide if you want to use that one, or not. – Haily
This did not help me and in fact sent me down another rabbit hole of build errors. Roberto Leinardi answer should be accepted as it worked like a charm. So it appears to be gradle and GMS compatibility issue. – Willawillabella
@AlexMamo I can up vote it if you remove the 2nd half of the plugins and clean task portion from your answer. I do not believe they are related to the issue. The reason is my code already had plugin definition and the cleanup task even before the AS upgrade. The only thing that made any difference was version upgrade. Thanks! – Willawillabella
@MGDeveloper I don't understand what you mean by "the 2nd half". Please edit my answer, to understand it more clearly. There is an edit button right under it. – Haily
If anyone gets this issue in future. This is clearly a version mismatch issue. Try by upgrading version (gms,gradle build) to the most compatible or try by downgrading build.gradle version to the original state and rest to the latest. This worked for me magically. However if you can figure out technically this is a version mismatch issue. – Apical
It's enough if you just set 4.3.15 as google-services! – Lalapalooza
Still failing in Android Studio Giraffe – Distracted
@HardikMehta Are you using Gradle version 8.1.0 and Google Services 4.3.15 and still fails? I doubt it, as I checked that personally. – Haily
Don't know fails for me Gradle version 8.1.0 and Google Services 4.3.15 if i degrade Gradle version to 7.4 then works fine – Distracted
Thanks for this, I only needed to edit the Google services to 4.3.15 – Congruity
@AlexMamo where to add plugins { id 'com.android.application' version '8.1.0' apply false id 'com.android.library' version '8.1.0' apply false } in gradle file ?? – Fatidic
@Fatidic Inside build.gradle (Project) file. – Haily
@AlexMamo can you please mention that where I should place both ? – Fatidic
buildscript { repositories { mavenCentral() google() } dependencies { classpath 'com.android.tools.build:gradle:8.1.3' classpath 'com.google.gms:google-services:4.3.14' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenCentral() google() } } tasks.register('clean', Delete) { delete rootProject.buildDir } – Fatidic
@Fatidic It's hard to read your unformatted code in the comment. Please post a new question, here on StackOverflow, using its own MCVE, so I and other Firebase developers can help you. – Haily
Agreed, this fixed it for me. I previously used the old Firebase authentication method (using Json). After updating my app to the latest flutter + firebase versions I had to authenticate using Flutterfire instead (which then led to the "missing GOOGLE AD_ID" issues), and THEN I had to follow this: https://mcmap.net/q/136217/-execution-failed-for-task-39-app-mapdebugsourcesetpaths-39-gt-error-while-evaluating-property-39-extrageneratedresdir-39-of-task to get it to export without any other errors. Now I genuinely don't know what I need to take out and leave in the gradle.build file, so both varients have been left in there. But it works. – Plasticity
@Plasticity Good to hear that, Delmontee. – Haily
Thanks! Just needed Google Services to go up to 4.4.0, and didn't need gradle version or AGP version (both till 7+) and this worked for me (finally!) on Android Studio Hedgehog – Decoupage
B
91

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'
Barouche answered 21/11, 2022 at 15:47 Comment(1)
This is the only thing I actually needed, thanks – Congruity
D
17

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'
Deepseated answered 21/9, 2023 at 11:2 Comment(0)
H
15

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

Heck answered 11/5, 2023 at 19:52 Comment(1)
is there any open bug? – Dropsical
I
9

For newbies like myself step by step instructions:

  1. Go to 'android/build.gradle'

  2. Find dependencies {}

  3. Replace there the classpath 'com.google.gms:google-services:4.3.10' with classpath 'com.google.gms:google-services:4.3.14'

  4. Rebuild.

Should work.


The full error text for the search purpose:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:mapDebugSourceSetPaths'.

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

  • Try:

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

Inweave answered 24/5, 2023 at 9:57 Comment(1)
Excellent! I updated Android Studio to the Flamingo version and a lot of problems arrived. One of them was solved with your solution. Thanks. – Dossier
S
6

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
    }
Starveling answered 14/12, 2022 at 7:36 Comment(0)
Y
6

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'
    // ...
}
Yes answered 24/11, 2023 at 13:58 Comment(1)
what version specifically? if version 4.4.0, how is this different than the accepted answer? – Build
L
4

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.

Lally answered 17/4, 2023 at 11:20 Comment(0)
A
2

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.

Andreas answered 3/10, 2022 at 6:40 Comment(0)
L
2

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

Luttrell answered 25/8, 2023 at 23:25 Comment(1)
Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From Review – Cabriolet
W
1

Just update you com.google.gms:google-services to latest version.

Weswesa answered 27/2, 2023 at 4:2 Comment(0)
T
1

Updating classpath 'com.google.gms:google-services' to the latest version solved the error for me.

Tetrapod answered 8/3, 2023 at 13:53 Comment(0)
R
1

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.

Retinite answered 10/8, 2023 at 7:58 Comment(0)
N
1

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'
Nod answered 12/8, 2023 at 5:16 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Gadolinite
V
1

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" />

Voidance answered 11/9, 2023 at 12:6 Comment(1)
Yeah nice. Helped me out, but where is the source for that? <preference name="GradlePluginGoogleServicesEnabled" value="true" /> – Freddafreddi
V
1

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'
Varese answered 6/11, 2023 at 20:33 Comment(0)
A
1

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>'
Aceldama answered 1/4, 2024 at 17:11 Comment(0)
K
0

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

Krystalkrystalle answered 23/10, 2022 at 18:20 Comment(0)
J
0

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 😊
}
Jarredjarrell answered 12/2, 2023 at 12:6 Comment(0)
E
0

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"
    }
}
Elongation answered 14/6, 2023 at 18:42 Comment(0)
F
0

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.

Favoritism answered 16/6, 2023 at 14:21 Comment(0)
F
0

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"
}
Fronton answered 26/8, 2023 at 14:15 Comment(0)
K
0

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 
}
Krystalkrystalle answered 31/8, 2023 at 18:48 Comment(0)
N
0

In my Flutter project I solved this by:

  1. going to 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"

}

  1. on terminal flutter clean

  2. flutter pub get

Notepaper answered 20/9, 2023 at 14:57 Comment(0)
H
0

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

Handmade answered 20/9, 2023 at 17:20 Comment(0)

© 2022 - 2025 β€” McMap. All rights reserved.