【问题标题】:Can not Link/Connect Android Studio with Firebase无法将 Android Studio 与 Firebase 链接/连接
【发布时间】:2021-02-08 19:27:51
【问题描述】:

我一直在尝试将 Android Studio 4.1 与 Firebase 连接,但没有连接。我按照 firebase 网站上的说明,将依赖项、插件等复制到应用程序 Gradle build 和 Project Gradle Build 中。我的 Gradle 版本是 6.5,Gradle 插件是 4.1。 显示的错误是:

org.codehaus.groovy.ast.expr.TupleExpression 不能转换为 org.codehaus.groovy.ast.expr.ArgumentListExpression

org.codehaus.groovy.ast.expr.TupleExpression 不能转换为 org.codehaus.groovy.ast.expr.ArgumentListExpression Gradle 的依赖缓存可能已损坏(这有时会在网络连接超时后发生。) 重新下载依赖并同步项目(需要网络)

Gradle 构建过程(守护程序)的状态可能已损坏。停止所有 Gradle 守护进程可能会解决此问题。

停止 Gradle 构建过程(需要重新启动)

您的项目可能正在使用与项目中的其他插件或项目请求的 Gradle 版本不兼容的第三方插件。 在 Gradle 进程损坏的情况下,您也可以尝试关闭 IDE,然后杀死所有 Java 进程。

【问题讨论】:

  • 我建议进行手动集成,而不是使用 Firebase 助手。遵循此处的文档:firebase.google.com/docs/android/setup
  • 更新 firebase 插件。它可能会解决问题
  • 手动集成有效。非常感谢!

标签: android firebase android-studio dependencies build.gradle


【解决方案1】:

我相信我找到了问题所在。 如果你使用

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

到你的build.gradle(module) 就像它指示你得到这个错误一样。

apply plugin改为id

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

我还没有完成应用,但是当我同步时,it's successful

【讨论】:

  • 谢谢,节省了我的时间。
  • 谢谢。无法相信文档对于这样一个基本的事情是错误的。
【解决方案2】:

使用 Firebase 指南将我的应用程序与 Firebase 链接,问题是您必须通过这两种实现方式分散插件:

//First way to implement plugins
plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

//Second way to implement plugins
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

从插件的 {} 中取出 apply plugin 解决了我的链接问题;)

【讨论】:

    【解决方案3】:

    我不知道这个信息有多正确,但是,我认为你应该删除代码块

    pugins{
      id '...'
    }
    

    相反,开始添加代码/插件,例如:

    apply plugin: "com..."
    

    基本上你的 firebase 建议的所有插件。它就像魔术一样工作,您不必丢失插件。

    Example Screen Shot

    【讨论】:

      【解决方案4】:

      如果您正在使用,则会出现此错误

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

      如果您在 build.gradle 中将 apply plugin: 替换为 id,则此错误将得到解决。 改动后

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

      【讨论】:

        【解决方案5】:

        //插件的第一种使用方式

        plugins {
            id 'com.android.application'
        }
        

        //插件的第二种使用方式。

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

        【讨论】:

          【解决方案6】:

          我通过添加解决了我的问题:

          plugins {
             id 'kotlin-kapt'
          }
          

          【讨论】:

            【解决方案7】:

            只需删除花括号,如下所示,不带花括号 每当使用应用插件时

            apply plugin: 'com.android.application'
            apply plugin: 'kotlin-android'
            apply plugin: 'com.google.gms.google-services'
            

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2020-06-24
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2020-08-26
              相关资源
              最近更新 更多