Not able to create user in the firebase

2,385 views
Skip to first unread message

Satya

unread,
Aug 24, 2016, 12:43:00 PM8/24/16
to Firebase Google Group
Hi,

I am using the following code to create a user in firebase with email and password.

progressDialog.setMessage("Registering the User...");
progressDialog.show();

fireBaseAuth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
public void onComplete(@NonNull Task<AuthResult> task) {
Toast.makeText(MainActivity.this, "Inside the firebaseAuth ", Toast.LENGTH_SHORT).show(); // <---- doesn't go here
if (task.isSuccessful()) {
Toast.makeText(MainActivity.this, "User Registered successfully", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this, "Please try again", Toast.LENGTH_SHORT).show();
}
}
});

There is no error but the app doesn't add the user in the firebase and the Progress dialog message "Registering the User..." gets displayed forever 
on the app. I tried to debug the code but couldn't find out why its not saving in firebase.

Any help in this regard is highly appreciated.

Thanks
Satya

Kato Richardson

unread,
Aug 24, 2016, 2:53:12 PM8/24/16
to Firebase Google Group

Hello Satya,

There’s really not going to be much we can do to help without a complete minimal repro and some more debug logs.

You can start by turning on debug logging for some useful clues, and making sure that the user is in fact authenticated at the time of the request. Here’s how to turn on debug logging;

JS:  firebase.database().enableLogging(true);
iOS:  [FIRDatabase setLoggingEnabled:YES];
Android:  FirebaseDatabase.getInstance().setLogLevel(Logger.Level.DEBUG);

☼, Kato


--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/3ca8adb5-6c78-46d9-b4ae-34429ff6b44e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Satya

unread,
Aug 25, 2016, 3:54:35 PM8/25/16
to Firebase Google Group
Hi Kato,

Thanks for the help. I am not able to include this code FirebaseDatabase.getInstance().setLogLevel(Logger.Level.DEBUG); as its saying 'cannot resolve FirebaseDatabase'.

Can you pls guide me on how to add it or pls send me the source from where I can get the info. I searched a lot in the internet but couldn't find any help.

Apologies if this is a basic topic, I am new to this technology.

Thanks much for the help.
Satya
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/3ca8adb5-6c78-46d9-b4ae-34429ff6b44e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kato Richardson

unread,
Aug 25, 2016, 3:57:26 PM8/25/16
to Firebase Google Group
Satya,

My fault. I didn't realize you weren't working with the Database (just the Auth module). Please still include some minimal code to reproduce the issue as that will help us find a starting point to troubleshoot.

☼, Kato

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Satya

unread,
Aug 25, 2016, 5:14:46 PM8/25/16
to Firebase Google Group
Hi Kato,

Below is the main code and attached is the screenshot of my app running on ADM. Hope this helps in recreating my prob. I even made the security rules in my firebase console as public to make sure that the user is authenticated at the time of request....but that didn't solve my issue.

protected void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);
        setContentView(R.layout.
activity_main);

       
editTextEmail = (EditText) findViewById(R.id.editTextEmail);
       
editTextPassword = (EditText) findViewById(R.id.editTextPassword);
       
buttonReg = (Button) findViewById(R.id.buttonReg);
       
textViewSignIn = (TextView) findViewById(R.id.textViewSignIn);

       
buttonReg.setOnClickListener(this);
       
textViewSignIn.setOnClickListener(this);

       
progressDialog = new ProgressDialog(this);
       
fireBaseAuth = FirebaseAuth.getInstance();

    }

   
private void registerUser() {
        String email =
editTextEmail.getText().toString().trim();
        String password =
editTextPassword.getText().toString().trim();

       
if (TextUtils.isEmpty(email)) {
            Toast.makeText(
this, "Please enter the Email", Toast.LENGTH_SHORT).show();
           
return;
        }

       
if (TextUtils.isEmpty(password)) {
            Toast.makeText(
this, "Please enter the password", Toast.LENGTH_SHORT).show();
           
return;
        }
       
progressDialog.setMessage("Registering the User...");
       
progressDialog.show();

        Toast.makeText(
this, "About to go to fireBaseAuth", Toast.LENGTH_SHORT).show();   //Its showing this msg and after this it wont go further

       
fireBaseAuth.createUserWithEmailAndPassword(email, password)
                .addOnCompleteListener(
this, new OnCompleteListener<AuthResult>() {
           
public void onComplete(@NonNull Task<AuthResult> task) {
                Toast.makeText(MainActivity.
this, "Inside the firebaseAuth method", Toast.LENGTH_SHORT).show();
               
if (task.isSuccessful()) {
                    Toast.makeText(MainActivity.
this, "User Registered successfully", Toast.LENGTH_SHORT).show();
                }
else {
                    Toast.makeText(MainActivity.
this, "Please try again", Toast.LENGTH_SHORT).show();
                }
            }
        });
    }

   
public void onClick(View view) {
       
if (view == buttonReg) {
            registerUser();
        }
       
if (view == textViewSignIn) {
           
//Open the page for signing in

       
}
    }

Thanks for your help
Satya
emulator.png

Kato Richardson

unread,
Aug 25, 2016, 5:43:38 PM8/25/16
to Firebase Google Group
Thanks, Satya,

What versions are we working with? Also, can you check the output in your run tab in Android Studio? The more data here the better.

Inline image 1

☼, Kato

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Satya

unread,
Aug 25, 2016, 10:40:11 PM8/25/16
to Firebase Google Group
Thanks Kato.

Android studio 2.1.2

firebase-auth:9.4.0

Android: compileSdkVersion 24
    buildToolsVersion "24.0.1"
minSdkVersion 9
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
SDK Tools: 25.1.7
Android platform Version: API24: Android 6X (N) revision 2

Google Play Services Version 32
Google Repository    version 32


Imp Messages on Run panel:

W/GooglePlayServicesUtil: Google Play services out of date.  Requires 9452000 but found 8489470
 Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
 Tasks have been queued for a long time
W/EGL_emulation: eglSurfaceAttrib not implemented
 W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xae4936e0, error=EGL_SUCCESS
 W/art: Suspending all threads took: 33.844ms


Please let me know if I missed to provide any other important info.

Satya

Samuel Stern

unread,
Aug 26, 2016, 10:14:03 AM8/26/16
to Firebase Google Group

Hi Satya,

This is the critical line here:


W/GooglePlayServicesUtil: Google Play services out of date.  Requires 9452000 but found 8489470

That means the SDK your using needs Google Play services 9.4.x on the device but your device only has 8.4.x.  Real decides are automatically updated so i suspect you're using an emulator.  If so, you'll need to go to the SDK manager, download the latest emulator image, and re-create your emulator.  Unfortunately emulators can't get over the air Play services updates so this is something you have to do once in a while.

- Sam


Satya

unread,
Aug 26, 2016, 3:38:25 PM8/26/16
to Firebase Google Group
Hi Sam,

Thanks for your post. I downloaded the latest emulator image and re-created it - but its not showing any device that has 9.4.x in my SDK manager. This time the error 'W/GooglePlayServicesUtil: Google Play services out of date.  Requires 9452000 but found 8489470' is not present but the problem is not solved.

The emulator screen still shows 'Registering the User......" and the user details are not added to firebase console.

There are no significant errors on the run panel except these..

W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xae4936e0, error=EGL_SUCCESS
 Suspending all threads took: 20.338ms
W/art: Suspending all threads took: 8.602ms
 W/art: Suspending all threads took: 19.559ms

Do I need to download the emulator that has 9.4.x ? pls guide me on how to as I couldn't find any info on internet.

Once again thanks much for your time Kato & Sam.

Satya

Samuel Stern

unread,
Aug 26, 2016, 3:49:31 PM8/26/16
to Firebase Google Group
In the Android SDK manager (which you can get to by running 'android sdk' in your terminal) look under the 'Android 6.0' section and make sure you have revision 9 of 'Intel x86 Atom_64 System Image' (or the non-64 one, if you prefer).

Then when you create an emulator with that image you can check the play services version by running the emulator and going to 'Settings > Apps > Google Play Services' and seeing what version it is running.

- Sam

Satya

unread,
Aug 27, 2016, 5:22:57 PM8/27/16
to Firebase Google Group
Hi Sam,

Now there is no such error "W/GooglePlayServicesUtil: Google Play services out of date. "  and no other errors too. but I am unable to see the output from my emulator as it keeps on running with the same message.

Is there anyway that I skip the emulator and run the code somewhere else as I do not have an Android device.

Thanks
Satya 

Samuel Stern

unread,
Aug 30, 2016, 12:05:03 PM8/30/16
to Firebase Google Group
Hi Satya,

Sorry about the delayed response here.  There's really no way to run the code without either an emulator or a physical Android device.  Are you unable to capture the output of your emulator from running 'adb logcat'?  Without some more logs it will be pretty hard to guess what is going on.

- Sam

Satya

unread,
Aug 31, 2016, 1:30:49 PM8/31/16
to Firebase Google Group
Hi Sam,

Atlast I am able to run my emulator on android studio and got the success message, firebase db has been updated too. I was trying to add emulators of different versions as I thought it might bypass the problem and 5.1 x86_64 image worked fine for me. 

I still do now know what has caused the problem but now, I am able to run my code.

Thanks a ton.
Satya
Reply all
Reply to author
Forward
0 new messages