得到错误"无法解析符号getInstance"在firebaseAuth中

时间:2016-09-11 14:09:47

标签: android firebase firebase-authentication

    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 个答案:

答案 0 :(得分:8)

变化:

firebaseAuth = new FirebaseAuth.getInstance()

firebaseAuth = FirebaseAuth.getInstance()