【发布时间】:2019-08-05 23:29:54
【问题描述】:
所以我正在尝试向我的应用添加身份验证和登录服务,我正在按照 FireBase 上的所有步骤进行操作,尽管我无法通过这部分,但它说错误是
createUserWithEmailAndPassword(Java.lang.String, Java.lang.String) 在 FireBaseAuth 不能应用于(Android.widget.text, Android.widget.text)
提前感谢您提供的任何帮助。代码如下:
public void Register(View view) {
Intent intent = new Intent(LoginActivity.this, BottomActivity.class);
startActivity(intent);
attemptLogin();
mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener( this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Log.d( TAG, "createUserWithEmail:success" );
FirebaseUser user = mAuth.getCurrentUser();
updateUI( user );
} else {
Log.w(TAG, "createUserWithEmail:failed");
Toast.makeText(LoginActivity.this, "Authentication failed", Toast.LENGTH_SHORT).show();
updateUI( null );
}
}
} );
}
电子邮件/密码:
private AutoCompleteTextView email;
private EditText password;
【问题讨论】:
-
显示你如何初始化变量 email 和 password
-
同时删除多余的空间
(email, password) -
请告诉我们在尝试进行身份验证时
emai和password的值是什么。也请回复@AlexMamo -
@AlexMamo 私人 AutoCompleteTextView 电子邮件;私人 EditText 密码;
-
你试过ribbit的解决方案吗?
标签: android firebase firebase-authentication