我有一个简单的应用程序,允许用户通过Auth方法注册到Firebase。这是我的代码:
public class SignUpActivity extends AppCompatActivity {
private FirebaseAuth mAuth;
private EditText tbemail;
private EditText tbpassword;
private Button btnCreate;
private Button btnSignIn;
private String str_email;
private String str_password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
mAuth = FirebaseAuth.getInstance();
//GUI DECLARATIONS
tbemail = (EditText) findViewById(R.id.tb_email);
tbpassword = (EditText) findViewById(R.id.tb_password);
btnCreate = (Button) findViewById(R.id.btn_create);
btnSignIn = (Button) findViewById(R.id.btn_signin);
btnCreate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
str_email = tbemail.getText().toString().trim();
str_password = tbpassword.getText().toString().trim();
mAuth.createUserWithEmailAndPassword(str_email, str_password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
//TASK SUCCESSFUL
Toast.makeText(SignUpActivity.this, "User Created Successfully!", Toast.LENGTH_LONG).show();
} else {
//TASK ERROR
Toast.makeText(SignUpActivity.this, "There was an error. Please Try Again.", Toast.LENGTH_LONG).show();
}
}
});
}
});
btnSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent signInIntent = new Intent(SignUpActivity.this, MainActivity.class);
finish();
startActivity(signInIntent);
}
});
}
}
但是当我尝试输入文本框并点击“创建用户”时,它给了我“抱歉有错误......”吐司,表示它无法注册新用户。 Logcat说E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb2b31680
有任何方法可以解决这个问题吗?
我已将我的项目连接到firebase;万一你想知道。
它刚刚在logcat Local module descriptor class for com.google.firebase.auth not found.
中向我展示了这一点。 (我什么都没做)
答案 0 :(得分:1)