Search code examples
androidfirebasegoogle-cloud-platformandroid-gradle-plugingoogle-play-services

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


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


Solution

  • 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' 👈
    }