【问题标题】:Android - Firebase Database Quickstart Gradle Project Sync FailedAndroid - Firebase 数据库快速入门 Gradle 项目同步失败
【发布时间】:2018-12-09 07:32:59
【问题描述】:

我正在尝试构建这个项目 Firebase Database Quickstart,但我在 App 级别 build.gradle 文件中遇到错误。

这是我的错误信息

通过搜索 googlestackoverflow 我找到了一些解决方案,然后我在我的 gradle 文件中添加了这个 'com.google.android.gms:play-services-auth:15.0.1' 行,这样我的错误从 6 减少到 3。

添加此'com.google.android.gms:play-services-auth:15.0.1'后的错误消息

现在我无法修复此错误。

我的 Google Play servicesGoogle Repository 版本是最新的,maven { url "https://maven.google.com" } 之前已经添加到项目级别的 build.gradle 中。

这是我的App Level gradle 文件:

apply plugin: 'com.android.application'
check.dependsOn 'assembleDebugAndroidTest'

android {
    compileSdkVersion 27

    defaultConfig {
        applicationId "com.google.firebase.quickstart.database"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.debug
        }
    }
}

configurations.all {
    resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}

dependencies {
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'

    implementation 'com.firebaseui:firebase-ui-database:4.0.0'

    implementation 'com.google.android.gms:play-services-auth:15.0.1'

    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.google.firebase:firebase-database:16.0.1'

    // Needed to fix a dependency conflict with FirebaseUI'
    implementation 'android.arch.core:runtime:1.1.1'

    // Needed to fix a dependency conflict with FirebaseUI'
    implementation 'android.arch.core:runtime:1.1.1'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    androidTestImplementation 'com.android.support.test:rules:1.0.2'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
}

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

【问题讨论】:

  • ddi u add classpath 'com.google.gms:google-services:4.0.1' in top level gradle?
  • 是的,我正在使用类路径 'com.google.gms:google-services:4.0.0'

标签: android firebase gradle firebase-realtime-database firebaseui


【解决方案1】:

尝试在顶级 gradle 中添加以下存储库。

google(), mavenLocal() and jcenter()

我遇到了同样的问题,我通过添加这些解决了。

【讨论】:

  • 你能进一步解释一下如何做到这一点吗?
  • 在项目的 build.gradle 文件中,将类路径更新为类路径 'com.google.gms:google-services:4.0.2' 并添加 allprojects { repositories { google() mavenLocal() jcenter( ) } }
猜你喜欢
  • 2015-01-16
  • 2014-07-03
  • 2014-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-22
相关资源
最近更新 更多