【问题标题】:Error:(26, 13) Failed to resolve: com.google.firebase:firebase-database:11.2.2 [duplicate]错误:(26, 13) 无法解决:com.google.firebase:firebase-database:11.2.2 [重复]
【发布时间】:2018-02-18 03:43:39
【问题描述】:

我正在尝试将 firebase 添加到我的 android 应用程序中。这是我第一次使用 Firebase。我已按照firebase docs 的所有说明进行操作,但出现此错误

错误:(26, 13) 无法解决:com.google.firebase:firebase-database:11.2.2

Build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
    applicationId "..."
    minSdkVersion 21
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.firebase:firebase-database:11.2.2'
}

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

我还在 build.gradle(项目)文件中包含以下行

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

Android Studio 版本为 2.1.2 Gradle 2.10 版

我还通过 SDK 管理器将 google play 服务和 play 存储库更新到最新版本。

有人可以帮忙吗?

【问题讨论】:

    标签: java android android-studio firebase


    【解决方案1】:

    更新你的工作室到 3.0 预览版和 gradle 版本到

    类路径'com.android.tools.build:gradle:3.0.0-beta4'

    【讨论】:

    • 升级 Android Studio 没有绝对的要求。此问题应作为重复问题关闭。
    • @DougStevenson 这不是重复的。链接问题中的解决方案不能解决此问题。 Google 在 Firebase 11.2.2 存储库中存在一些配置问题。我最终切换回 11.2.0
    猜你喜欢
    • 2018-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-17
    • 1970-01-01
    • 1970-01-01
    • 2018-12-12
    • 2020-05-02
    相关资源
    最近更新 更多