简体   繁体   中英

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

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'

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.2.0' apply false
    id 'com.android.library' version '7.2.0' apply false
    id 'com.google.gms.google-services' version '4.3.10' 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' 👈
}

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.

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 .

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

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
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM