无法创建任务 ':app:processDebugGoogleServices'

Could not create task ':app:processDebugGoogleServices'

**所以我在添加这一行时遇到了问题

id 'com.google.gms.google-services'

进入应用中的插件gradle

**

    Could not create task ':app:processDebugGoogleServices'.
DefaultTaskContainer#NamedDomainObjectProvider.configure(Action) on task set cannot be executed in the current context.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not create task ':app:processDebugGoogleServices'.
DefaultTaskContainer#NamedDomainObjectProvider.configure(Action) on task set cannot be executed in the current context.
    at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:259)
    at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:117)
    at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:42)
    at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter.execute(InternalBuildActionAdapter.java:77)
    at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner$ActionRunningListener.runAction(ClientProvidedPhasedActionRunner.java:120)
    at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner$ActionRunningListener.run(ClientProvidedPhasedActionRunner.java:110)
    at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner$ActionRunningListener.buildFinished(ClientProvidedPhasedActionRunner.java:104)
    at jdk.internal.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:398)
    at org.gradle.internal.event.DefaultListenerManager$ListenerDetails.dispatch(DefaultListenerManager.java:380)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:61)
    at org.gradle.internal.event.DefaultListenerManager$EventBroadcast$ListenerDispatch.dispatch(DefaultListenerManager.java:368)
    

**现在这条线对于 android 的 firebase 是必需的 因为我想如果我删除这一行可能会在代码中出现问题我希望你们理解我**

**当我添加 firebase 云消息传递时,所有这些问题都发生了,但我发现这不是问题,问题只在那一行**

*

id 'com.google.gms.google-services'

是的,我遇到了同样的问题

但你可以尝试改变

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

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

在应用级别 gradle 文件

看看是否有效

关于此的小更新:版本 4.3.10,此 bug was fixed

因此您可以将 com.google.gms:google-services 的版本更改为 4.3.10