执行失败的任务':app:mapdebugsourcesetths'。 >评估属性的错误' extrageneratedResdir'任务

发布于 2025-01-28 14:38:17 字数 565 浏览 5 评论 0 原文

我已经检查了这个答案:

https://stackoverflow.com/a/34834772/13519865

apply plugin: 'com.google.gms.google-services'

构建,但我无法使用firebase(OFC!),它导致了一个新的错误,这告诉我添加该行: https://stackoverflow.com/a/40085096/13519865

所以,我在这里挂在这里。 相关代码示例此处添加 https://github.com/cyberavater/a.reader

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(26

演多会厌 2025-02-04 14:38:17

此问题在更新 com.android.tools.build:Gradle 7.3.0 后开始,并在更新 com.google.gms后为我修复了 。 :Google-Services 到版本 4.3.14

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.

葵雨 2025-02-04 14:38:17

编辑: 2024年4月15日,

同一问题似乎出现在最新您需要指定Gradle版本为 8.3.2 和Google Services 4.4.1 。因此,这里是工作版本:

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

编辑: 10月16日,2023年,

同一问题似乎出现在最新的 Android Studio Electric长颈鹿2022.3.1补丁3 您需要在其中指定Gradle版本为 8.1.3 和Google Services Services 4.4.4.0 。我试图查看 5.0.0 版本是否有效,但我得到了:

插件[id:'com.google.gms.google-services',版本:'5.0.0',应用:false:false]在以下任何来源中都找不到:

因此,这里是工作版本:

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: edit: 8月15日,2023年8月15日,

同样的问题似乎出现在最新的 android studio electric electric electric electric giraffe 您需要在哪里指定Gradle版本为 8.1.0 和Google Services 4.3.15 。如果 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'
}

编辑: 2023年3月24日,

同一问题似乎出现在最新您需要在哪里指定Gradle版本为 7.4.0 和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'
}

编辑: 2023年1月4日,

我看到了最新的 android Studio Dolphin 发行,您需要在其中指定Gradle版本为 7.3.1 和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'
}

根据新的 chipmunk 如果您需要使用Google服务,则必须在您的build.gradle(project)文件中添加以下代码行:

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

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' ????
}
流绪微梦 2025-02-04 14:38:17

在>>中更改此行android/

classpath 'com.google.gms:google-services:4.3.10'

build.gradle

classpath 'com.google.gms:google-services:4.3.14'

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'
故事和酒 2025-02-04 14:38:17

2023年:这对我有用。

classpath 'com.google.gms:google-services:4.3.10'

classpath 'com.google.gms:google-services:4.3.15'

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'
楠木可依 2025-02-04 14:38:17

打开您的android文件夹,然后构建。gradle并找到

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

并最终更改 classpath'com.google.gms.gms:Google-Services:4.3.10' to class> class> classpath'com.google.gms.gms:google--服务:4.3.15'
现在您的代码应该看起来像

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

希望这会有所帮助

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

情栀口红 2025-02-04 14:38:17

对于像我这样的新手,逐步说明:

  1. 转到'android/build.gradle'

  2. 查找依赖项{}

  3. 替换那里
    classpath'com.google.gms:Google-Services:4.3.10'

    classPath'com.google.gms:Google-Services:4.3.14'

  4. 重建。

应该工作。


出于搜索目的的完整错误文本:

在调试模式下在SDK GPHONE64 ARM64上启动lib/main

  • 出了什么问题:
    执行失败的任务':app:mapdebugsourcesetths'。

错误在评估属性“任务范围”的属性':app:mapdebugsourcesetths'
无法计算任务的值':app:mapdebugsourcesetpeths“属性” extrageneratedResdir'。
>在任务之前查询提供商(Java.util.set)的映射值':APP:ProcessDebugGoogleServices'已完成

使用-stacktrace选项运行以获取堆栈跟踪。
使用-Info或 - debug选项运行,以获取更多日志输出。
运行 - 扫描以获得完整的见解。


例外:Gradle任务汇编失败,出口代码1
退出

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

这个俗人 2025-02-04 14:38:17

我面临着同样的问题,但是在更新了依赖性之后,问题得到了解决。

在我的项目级别的Gradle文件中,如下所示:

 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
    }

在下面更新后,它对我正常工作。

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
    }

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
    }
潜移默化 2025-02-04 14:38:17

我使用此链接使用最新的Google Services插件来解决:
https://developers.google.com/android.com/android/guides/google/google -Services-Plugin?hl = tr

现在链接提供这样的链接

dependencies {
    classpath 'com.google.gms:google-services:4.4.0'
    // ...
}

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'
    // ...
}
神仙妹妹 2025-02-04 14:38:17

在我的flutter项目的Android/build.gradle中,我进行了:

classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.10'

我通过将行更改为更新

classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.google.gms:google-services:4.3.14'

,并解决了错误。自从我安装了最新版本的Flutter以来,当我将Flutter Project转移到新的笔记本电脑和Java版本中时,这发生了。

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.

最美的太阳 2025-02-04 14:38:17

如果亚历克斯·马莫(Alex Mamo)的答案不能为您解决问题,请阅读此内容。

Android Studio的新更新优先级或更喜欢设置。有两种可能的解决方案。

解决方案1。如下更新现有项目。

更新您的设置.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'

更新您的build.gradle(project)。使用您的Gradle版本,此示例使用版本7.3.0和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
}

将其添加到您的build.gradle(App)

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
    // other plugins
}

解决方案2。您可以创建一个新项目,并将所有类并将XML移至新项目中。

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.

孤芳又自赏 2025-02-04 14:38:17

已解决的

替换classpath'com.google.gms:Google-Services:4.3.10'with classpath'com.google.gms.gms:Google-Services:4.3.14'在Android/build.gradle中

检查最新的GS在这里:
https://developers.google.com/android/guides/google-services-插件

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

关于从前 2025-02-04 14:38:17

只需更新您 com.google.gms:Google-Services 到最新版本。

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

找回味觉 2025-02-04 14:38:17

更新 classPath'com.google.gms:Google-Services'最新版本为我解决了错误。

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

峩卟喜欢 2025-02-04 14:38:17

我在Android Studio 2022.3.1中遇到了同样的错误。

通过打开Android/build.gradle并将构建Gradle版本升级到7.3.1,将Google Services版本升级到4.3.15,

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.

烟─花易冷 2025-02-04 14:38:17

对于Cordova-Builds:我缺少config.xml中的以下属性:

&lt; preference name =“ gradlePlugingOogleServicesEnabled” value =“ true” /&gt; < /code>

config.xml中您还可以设置GoogleServices版本(如果您想在Cordova项目中应用其他用户的答案,而无需提交平台或插件目录):
&lt; preference name =“ gradleplugingoogleservicesversion” value =“ 4.3.15” /&gt; < /code>

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

冬天的雪花 2025-02-04 14:38:17

这对我有用:
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'

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'
撧情箌佬 2025-02-04 14:38:17

在&gt;&gt;中更改此行您的项目/android/build.gradle

classpath 'com.google.gms:google-services:4.3.10'

classpath 'com.google.gms:google-services:4.3.14'

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'
多情出卖 2025-02-04 14:38:17

转到此链接 https://developers.google.com/andandroid/guides/guides/guides/ Google-Services-Plugin 。在中,Android/build.gradle 使用该页面中显示的版本代替&lt;最新版本&gt; 在以下。

classpath 'com.google.gms:google-services:<latest-version>'

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>'
や三分注定 2025-02-04 14:38:17

尝试删除.idea和.gradle文件夹,然后从应用程序的root中,然后是从主应用程序模块中... Android Studio Dolphin中的Bug,我用克隆与新项目的克隆一起解决了它

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

四叶草在未来唯美盛开 2025-02-04 14:38:17

首先检查您的build.gradle(项目),并在插件下方粘贴这些代码,并同步您的项目。

task clean(type: Delete) {
delete rootProject.buildDir

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 ????
}
心的位置 2025-02-04 14:38:17

就我而言,问题涉及app/build.gradle,我倾向于设置三个值:(1)compilesdkversion,(2)minsdkversion和(3)Targetsdkversion。

在这种情况下,我发现自己设置了四个值,因为Android Studio的新版本为我提供了选择,但是我感到困惑,将“第四”值与通常的三个值之一混合在一起,但事实证明第四个值是不应该触摸的人,如果您对其进行修改,那么您将四处逛逛,以寻找一种解决永无止境的错误消息的方法 - 因此,我遇到了这篇文章。

示例

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

如果您在应用程序/build.gradle文件中看到上述内容,请不要修改它,如果您对其进行了修改,请复制您在此处看到的内容或还原为默认值。设置正确的位置后,错误就会消失并颤动运行(如果您为通常的三个设置设置了正确的设置)。

如果此答案对您有所帮助,请记住勾选它,以便它也可以帮助他人。

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.

非要怀念 2025-02-04 14:38:17

在flutter-&gt; 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"
    }
}

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"
    }
}
哆兒滾 2025-02-04 14:38:17

转到Android/buil.gradle

用以下代码替换与依赖关系相关的代码:

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

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"
}
断肠人 2025-02-04 14:38:17

首先,将此行从您的build.gradle文件和所有相关文件中删除使用Google Play服务(AD,Firebase等...),

     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
    } 

然后在您的应用级别build.gradle文件中删除此行,

您必须删除与Google Play服务相关的所有文件。 ..

 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 
}

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 
}
-残月青衣踏尘吟 2025-02-04 14:38:17

在我的扑波项目中,我解决了以下方法:

  1. 转到 android/build.gradle

依赖项{

classpath'com.android.tool.tool.tools.builds.build:7.3.0 '

classPath'com.google.gms:Google-Services:4.3.14'

classpath'org.jetbrains.kotlin.kotlin:kotlin-gradle-plugin:$ kotlin_version”代码>

}

  1. 在终端上

  2. flutter Pub获取

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

心清如水 2025-02-04 14:38:17

这很可能是版本不兼容的问题。尝试为您的AGP(Android Gradle插件)找到兼容的Google-Services Gradle插件版本或降级AGP。

选定的答案(几乎经常定期)使用兼容对。

可悲的是,他们没有提供兼容性矩阵,我只能找到它: https://github.com/google/google/play-services-services-plugins/tree/tree/master/google-services-services-services-plugin-plugin-plugin-plugin-vandroid-gandroid-gladle-gradle-plugin-plugin-compatibility

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文