Ich fügte hinzu
apply plugin: 'com.google.gms.google-services'
compile 'com.google.firebase:firebase-auth:10.0.1'
in build.gridle (App)
Und im Modul habe ich hinzugefügt
classpath 'com.google.gms:google-services:3.0.0'
Und das ist mein Code
public class splashscr extends Activity implements View.OnClickListener{
TabHost tab ;
Button logbtn,signup;
EditText email,password,signupemail,signuppassword;
private FirebaseAuth firebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tab =(TabHost) findViewById(R.id.tabhost);
logbtn = (Button) findViewById(R.id.btn_login);
signup = (Button) findViewById(R.id.btn_signup);
password = (EditText)findViewById(R.id.input_password);
email = (EditText)findViewById(R.id.input_email);
signupemail =(EditText)findViewById(R.id.signupinput_email);
signuppassword = (EditText) findViewById(R.id.signupinput_password);
firebaseAuth = FirebaseAuth.getInstance();
logbtn.setOnClickListener(this);
signup.setOnClickListener(this);
tab.setup();
TabHost.TabSpec spec = tab.newTabSpec("tag1");
spec.setIndicator("",getResources().getDrawable(R.drawable.loginpic));
spec.setContent(R.id.tab1);
tab.addTab(spec);
spec = tab.newTabSpec("tag2");
spec.setIndicator("",getResources().getDrawable(R.drawable.signupp));
spec.setContent(R.id.tab2);
tab.addTab(spec);
}
@Override
public void onClick(View view) {
final Intent I = new Intent(this,HomeActivity.class);
final String emailout = signupemail.getText().toString();
final String passwordout = signuppassword.getText().toString();
if (view == signup){
(firebaseAuth.createUserWithEmailAndPassword(emailout,passwordout)).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
Toast.makeText(splashscr.this, "تم تسجيلك بنجاح ", Toast.LENGTH_SHORT).show();
startActivity(I);
finish();
}
else
{
Log.e("ERROR", task.getException().toString());
Toast.makeText(splashscr.this, "فشل التسجيل", Toast.LENGTH_SHORT).show();
}
Toast.makeText(splashscr.this,emailout+passwordout, Toast.LENGTH_SHORT).show();
}
});
}
}
}
Und ich bekomme diesen Fehler:
E/ERROR: com.google.firebase.FirebaseException: An internal error has occurred. [ OPERATION_NOT_ALLOWED ]
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
was ist das Falsche?
Versuchen Sie, Ihren Client erneut mit Ihrer Firebase-App zu synchronisieren, und fügen Sie erneut die .json-Datei hinzu In Android Studio 2.3 klicken Sie einfach auf Tools> Firebase.
Melden Sie sich an Ihrer Firebase-Konsole an und aktivieren Sie E-Mail/Passwort-Anmeldung-Methode, um das Problem zu beheben.
Überprüfen Sie in Ihrer Firebase-Konsole, ob "anonyme Authentifizierung" zulässig ist. Es sollte Ihr Problem lösen.
Überprüfen Sie auch die INTERNET-Berechtigung in Ihrem Manifest. Es ist so offensichtlich, aber ...
Viel Glück.