当将firebase项目从旧域升级到新的谷歌firebase域时,我得到以下错误。

未能解决:com.google.firebase:firebase-core:9.0.0

我遵循了Firebase文档中提到的步骤,在“将Firebase添加到您的Android项目”主题中,可用库。

解决此错误的选项是什么?


当前回答

在我的例子中,除了在项目级gradle文件的存储库中添加谷歌()之外,我还必须将它包含在应用级gradle文件中。

repositories {
    mavenLocal()
    google()
    flatDir {
        dirs 'libs'
    }
}

其他回答

错误:(30,13)Failed to resolve: com.google.firebase:firebase-auth:9.6.1

如果你遇到这个错误,并且你使用的是Android studio 2.2,其中集成了firebase组件,默认的库版本为9.6.0,你正在添加9.6.1等最新的依赖项。您可能需要将com.google.firebase:firebase-auth:9.6.1降级为com.google.firebase:firebase-auth:9.6.0

或者检查您预先安装的firebase的库版本,并确保它与您试图添加或添加到项目中的新库版本相同。

以上都试过了,使用Firebase助手吧!这是最简单的解决方法。首先删除添加到构建中的所有依赖项。gradle(使用手动方法),然后在Android Studio中:

Click Tools > Firebase to open the Assistant window.

真的就这么简单。

进入Android SDK管理器,安装以下两个库的最新版本

谷歌播放服务 谷歌库

dependencies {
    compile 'com.google.android.gms:play-services-maps:11.8.0'
    compile 'com.google.android.gms:play-services-auth:11.8.0'
    compile 'com.google.android.gms:play-services-ads:11.8.0'
    compile 'com.google.firebase:firebase-storage:11.8.0'

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


// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {


        maven { url 'https://maven.fabric.io/public' }

        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath 'com.google.gms:google-services:3.1.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

如果您想将firebase添加到项目中,以下是先决条件。

要使用Firebase,您应该安装Android Studio 1.5或更高版本。 通过Android SDK管理器下载最新的谷歌播放服务SDK。 设备应运行Android 2.3 (Gingerbread)或更新版本,谷歌Play服务9.2.0或更新版本。

我经过几个小时的挣扎才知道这一切。

来源:添加Firebase到你的Android应用程序