gpt4 book ai didi

android - FireBase 身份验证 mAuth.createUserWithEmailAndPassword(电子邮件,密码)错误

转载 作者:行者123 更新时间:2023-11-29 23:16:53 25 4
gpt4 key购买 nike

所以我正在尝试向我的应用程序添加身份验证和登录服务,我正在按照 FireBase 上的所有步骤进行操作,尽管我无法完成这一部分,它说错误是

createUserWithEmailAndPassword(Java.lang.String, Java.lang.String) in FireBaseAuth cannot be applied to (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;

最佳答案

这样使用

 mAuth.createUserWithEmailAndPassword(email.getText().toString(), password.getText().toString()).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 );
}
}
} );

关于android - FireBase 身份验证 mAuth.createUserWithEmailAndPassword(电子邮件,密码)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55173213/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com