本文介绍了在console.firebase.google.com上创建的项目必须使用可从firebase.google.com/dosc/auth获得的新Firebase身份验证SDKx.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的Android应用启用GoogleSignIn,并尝试运行代码.我已经从firebase控制台创建了json文件,并将其粘贴到应用中.从firebase启用了google登录,但在手机上运行应用程序后却出现错误.

I am trying to enable GoogleSignIn for my android app and trying to run this code. I have created the json file from firebase console and pasted it in app. Enabled the google login from firebase but after running app on my phone it gives me error.

firebaseError: Projects created at console.firebase.google.com must use the new Firebase Authentication SDKx available from firebase.google.com/dosc/auth

类似线程表示要删除Firebase客户端依赖项,但是如果删除它,则会出现编译错误.我还尝试从 docs 添加最新的依赖项,但是没有运气

Similar threads said to remove firebase client dependency but if I remove it I have compilation error. I also have tried to add latest dependency from the docs but no luck.

我的gradle文件

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}
apply plugin: 'com.android.application'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

    defaultConfig {
        minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
    }
}

dependencies {
    compile 'com.firebase:firebase-client-android:2.0.3+'
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'com.google.android.gms:play-services:5.0.89'
    compile 'org.twitter4j:twitter4j-core:4.0.2'
    compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}

我想念什么?除了firebase -client之外,我还必须添加什么依赖项,因为如果添加最新的代码,则仍然无法正常工作.

What am I missing? What dependency I have to add other than firebase -client because if I add the latest the code still doesnt work.

删除后

compile 'com.firebase:firebase-client-android:2.0.3+'
compile 'com.google.android.gms:play-services:5.0.89'

并添加

  compile 'com.google.firebase:firebase-auth:10.2.0'
  compile 'com.google.android.gms:play-services-auth:10.2.0'

所以我的依赖看起来像这样

So my dependency looks like this

dependencies {
    compile 'com.google.firebase:firebase-auth:10.2.0'
    compile 'com.google.android.gms:play-services-auth:10.2.0'
    compile 'com.android.support:appcompat-v7:20.0.0'
    compile 'org.twitter4j:twitter4j-core:4.0.2'
    compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}

但是对于上面的依赖性,我现在在代码中遇到了编译问题.

But for Above dependency now I have compilation issues in my code like.

For import com.firebase.client.Firebase; Cannot find the symbol client
import com.google.android.gms.plus.Plus; Cannot find the symbol plus

推荐答案

我刚刚从链接.登录和登录真的很容易.Firebase可以完成所有工作.您可以在下面的链接中找到错过的配置.

I have just created new project from link. It 's really easy to follow and sign in. Firebase did all work. You can discover the link below to know which configuration you missed.

在Google项目中测试唱歌的链接

这篇关于在console.firebase.google.com上创建的项目必须使用可从firebase.google.com/dosc/auth获得的新Firebase身份验证SDKx.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 18:52