我遇到一个错误:
2019-02-08 15:52:45.844 28896-28896 /? E / Zygote:isWhitelistProcess- 流程已列入白名单2019-02-08 15:52:45.846 28896-28896 /? E / libpersona:scanKnoxPersonas 2019-02-08 15:52:45.846 28896-28896 /? E / libpersona:无法打开文件- /data/system/users/0/personalist.xml-没有这样的文件或目录 2019-02-08 15:53:12.280 28896-28896 / com.example.servicees E / ViewRootImpl:sendUserActionEvent()已返回。
同时尝试将给定代码启动到我的手机Samsung Galaxy J6中。我在Android Studio中进行编码,并在Firebase中使用电子邮件和密码注册方法。有人可以告诉我解决方案吗?预先感谢您。
public class MainActivity extends AppCompatActivity {
EditText etName, etService, etDes, etCost, etContact, etPass, etEmail;
Button offer;
CountryCodePicker ccp;
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
etName = findViewById(R.id.enterName);
etService = findViewById(R.id.enterService);
etDes = findViewById(R.id.enterDescription);
etCost = findViewById(R.id.enterCost);
etContact = findViewById(R.id.enterContact);
etPass = findViewById(R.id.enterPassword);
etEmail = findViewById(R.id.enterEmail);
ccp = findViewById(R.id.ccpLogin);
ccp.registerCarrierNumberEditText(etContact);
offer = findViewById(R.id.offerBtn);
mAuth=FirebaseAuth.getInstance();
offer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/*final String putName=etName.getText().toString();
final String putService=etService.getText().toString();
final String putDes=etDes.getText().toString();
final String putCost=etCost.getText().toString();*/
final String putEmail=etEmail.getText().toString();
final String putPass=etPass.getText().toString();
//final String fullNumber = ccp.getFullNumberWithPlus();
//final String key=fullNumber+putEmail;
if(notEmpty()){
mAuth.createUserWithEmailAndPassword(putEmail, putPass).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful())
{
final String putName=etName.getText().toString();
final String putService=etService.getText().toString();
final String putDes=etDes.getText().toString();
final String putCost=etCost.getText().toString();
final String putEmail=etEmail.getText().toString();
final String putPass=etPass.getText().toString();
final String fullNumber = ccp.getFullNumberWithPlus();
User user = new User(putName, putService, putDes, putCost, fullNumber, putPass);
FirebaseDatabase.getInstance().getReference("Users").child(putEmail).setValue(user);
Toast.makeText(MainActivity.this, "Registered", Toast.LENGTH_LONG).show();
}
else
Toast.makeText(MainActivity.this, "Failed", Toast.LENGTH_LONG).show();
}
});
}
else
Toast.makeText(MainActivity.this, "All Fields Are Required", Toast.LENGTH_LONG).show();
}
});
}
public boolean notEmpty() {
Boolean checker;
String checkEmName = etName.getText().toString();
String checkEmService = etService.getText().toString();
String checkEmDes = etDes.getText().toString();
String checkEmCost = etCost.getText().toString();
String fullNumberCh = ccp.getFullNumberWithPlus();
String checkEmEmail = etEmail.getText().toString();
String checkEmPass = etPass.getText().toString();
if (checkEmName.isEmpty() || checkEmService.isEmpty() || checkEmDes.isEmpty() || checkEmCost.isEmpty() || fullNumberCh.isEmpty() || checkEmEmail.isEmpty() || checkEmPass.isEmpty())
checker = false;
else
checker = true;
return checker;
}
}