android - Firebase 中的用户注册问题
问题描述
我已经成功连接firebase
并添加了所有必需的依赖项,但我无法将用户注册到其中。我写的代码在这张图片中我还提供了gradle
依赖项列表请检查我哪里出错了
我已经在 firebase 中启用了电子邮件和密码验证,但它不起作用。
这是我的依赖项列表。
dependencies
{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
解决方案
您需要提供更多信息,然后社区才能帮助您解决问题。
要获取更多信息,我建议注销异常并共享它。在代码的 else{} 块中添加以下行:
Log.w(TAG, "createUserWithEmail:failure", task.getException());
所以它看起来像这样(我无法复制粘贴您的代码,因为它是一个图像 - 将您的代码作为问题中的文本共享总是有帮助的,以便其他人可以复制和更正它):
mAuth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// your code here
} else {
//your toast here
Log.w(TAG,"createUserWithEmail:failure",task.getException());
}
注销的错误可以在 Android Studio 底部的 Logcat 部分找到:
谢谢
推荐阅读
- javascript - 我希望结果输出有多少 str2 匹配与 str1 匹配的字符串值。需要多少是真假的代码,比如总分
- spring - 使用 redis 和 mongodbb 得到 NoSuchBeanDefinitionException
- schema.org - 合同占位符,如何用 JSON-LD 表示?
- tensorflow - 如果步幅大小与输入图像的高度和宽度相同怎么办?
- css - 进度条根本不显示
- android - 来自活动的事务后,布局不会在片段中膨胀
- java - Intellij Formatter 将方法级别注释和方法签名保持在一行中
- azure - 我想知道如何使用 LUIS 区域密钥
- mysql - MySQL 复制 - 从站连接到主站但不复制
- android - Kotlin 扩展到第二个构造函数