【问题标题】:Can't connect to Firebase - Need to resolve app gradle issues无法连接到 Firebase - 需要解决应用 gradle 问题
【发布时间】:2019-04-23 20:01:46
【问题描述】:

我在尝试连接到 Firebase 时遇到以下错误(如果重要的话,那就是 Firebase 身份验证):

无法解析 Android 应用模块的 Gradle 配置。解决 gradle 构建问题和/或重新同步。

*Gradle 同步时不会出错。

这就是我的应用程序 gradle 依赖项的样子:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:design:+'
    implementation 'com.google.android.gms:play-services-nearby:16.0.0'
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
 }

【问题讨论】:

  • 将所有compile替换为implementation并同步项目
  • 成功了,谢谢!

标签: android firebase


【解决方案1】:

正如我在 cmets 中提到的,您应该将compile 替换为implementation,然后按下同步项目按钮。

请注意:

编译配置仍然存在,但不应使用,因为它不会提供 api 和实现配置提供的保证。

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,但至少我设法解决了它,解决这个问题的最佳方法是将以下依赖项更新为这些依赖项。

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.2'
        classpath 'com.google.gms:google-services:4.3.3'
    

    【讨论】:

      【解决方案3】:

      我只是想为我的应用设置 Firebase 测试实验室,所以我实际上不需要将我的应用连接到 Firebase。

      我最终跳过了连接到 Firebase 步骤并跳转到第 4 步,在云中运行应用测试,它运行良好。

      【讨论】:

        猜你喜欢
        • 2017-04-10
        • 2015-07-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-11-07
        • 2020-06-12
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多