繁体   English   中英

Android Firebase 电子邮件和密码身份验证不起作用

[英]Android Firebase Email and password authentication does not work

我正在尝试使用 Firebase 在 Android 应用中创建帐户。 当我在 app build.grade 文件中添加以下依赖项时 -

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.firebase:firebase-client-android:2.5.2'
    compile 'com.firebaseui:firebase-ui:1.0.1' 
    compile 'com.google.firebase:firebase-auth:10.0.0'//added also tried 10.0.1
    testCompile 'junit:junit:4.12'
}

我收到以下神秘的构建错误(顺便说一句,据我所知,我没有使用任何 Twitter SDK 或任何东西):

Error:Failed to resolve: com.twitter.sdk.android:twitter:2.2.0

当我将依赖项更改为:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.firebase:firebase-client-android:2.5.2'
    compile 'com.firebaseui:firebase-ui:0.6.2'//changed
    compile 'com.google.firebase:firebase-auth:9.8.0'//changed
    testCompile 'junit:junit:4.12'
}

应用程序构建和编译正常,但是当我尝试创建帐户时,出现以下错误:

Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/

我不知道我应该做什么,因为我认为我使用的是最新版本的 Firebase SDK。

更多信息是我使用了mFirebaseRef.createUser()mAuth.createUserWithEmailAndPassword ,但没有成功。

我使用此链接来更改依赖项。

任何帮助将不胜感激。

您正在混合旧版 SDK

compile 'com.firebase:firebase-client-android:2.5.2'

使用新的 SDK

compile 'com.google.firebase:firebase-auth:10.0.0'

这将导致许多问题,并且是此错误消息的原因:

Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/

对于新开发,您应该只使用新的 SDK。 从您的依赖项中删除此行:

compile 'com.firebase:firebase-client-android:2.5.2'

最新版本的FirebaseAuth需要额外的存储库。 对您的项目(顶级) build.gradle 文件进行此更改:

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        mavenLocal()
    }
}

更改摘自Firebase 示例项目。 它将消除此错误:

Error:Failed to resolve: com.twitter.sdk.android:twitter:2.2.0

您应该使用 Google 提供的正确 firebase 身份验证版本:

compile 'com.google.firebase:firebase-auth:10.0.1'

您必须按照官方文档中的描述设置 Firebase

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM