Reputation: 244
I added
apply plugin: 'com.google.gms.google-services'
compile 'com.google.firebase:firebase-auth:10.0.1'
in build.gridle(app)
And in the module I added
classpath 'com.google.gms:google-services:3.0.0'
And this is my 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();
}
});
}
}
}
And I get this error:
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.
what is the wrong?
Upvotes: 10
Views: 25194
Reputation: 309
This issue happened to me after changing the firebase rules. My IOS Simulator worked just fine but Android Emu did not. I fix this by wiping all data from my device in my emulator and then re-launching the EMU. Probably you dont even need to wipe data from emulated device.
Upvotes: 0
Reputation: 29
Make sure you have to tack care of
Internet Permission ,compile library and Enable only one Auth From firebase auth list not.
In my case i enable 2 Authentication from list Google and Email/Password, so that is not work but after disable Google.. then its work correctly.
I hope my answer is help you.
Upvotes: -3
Reputation: 258
Make sure your emulator has the Play Store.
When you do not have Play Store installed on the emulator, this error occurs.
Upvotes: 4
Reputation: 127
Log into your firebase console and Enable Email/Password Sign-In_Method, it should solve the issue.
Upvotes: 2
Reputation: 81
Try re sync your client with your Firebase app, and add again the .json file. In android studio 2.3 just click on tools>firebase and in the assistant check if your app is connected to.
Upvotes: 8
Reputation: 61
Check in your Firebase console that "anonymous auth" is allowed. It should solve your problem.
Also check INTERNET permission in your manifest. It so obvious, but...
Good Luck.
Upvotes: 0