protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
...
firebaseAuth = new FirebaseAuth.getInstance();
在-> getInstance()中获取错误
}
public void registerUser(){
...
firebaseAuth.createUserWithEmailAndPassword(email,password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Toast.makeText(MainActivity.this,"Registered successfully",Toast.LENGTH_SHORT).show();
}else {Toast.makeText(MainActivity.this,"Registered unsuccessful",Toast.LENGTH_SHORT).show();}
}
});
我已经正确地将Firebase与我的项目同步,但出现此错误。
1条答案
按热度按时间wz3gfoph1#
查看
FirebaseAuth.getInstance()
的documentation。它是一个静态方法,返回默认的FirebaseAuth。你不想创建一个新的示例,你想要现有的默认示例。变更:
收件人: