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与我的项目同步但出现此错误。
答案 0 :(得分:8)
变化:
firebaseAuth = new FirebaseAuth.getInstance()
到
firebaseAuth = FirebaseAuth.getInstance()