2

I am using the code example on Firebase site. For some reason, I do not seem to get to onComplete method at all and get stuck after entering the if statement. Please advice. Thanks.

if(isRegistering){
    Log.d("TEST", "isRegistering"); // <- THIS PRINTS
    mAuth.createUserWithEmailAndPassword(email, password)
        .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
        @Override
        public void onComplete(@NonNull Task<AuthResult> task) {
            if (task.isSuccessful()) {
                Log.d("TEST", "success"); // <- DOESN'T PRINT
            }
            else {
                Log.d("TEST", "fail"); // <- DOESN'T PRINT
            }
        }
    });
}

Update: Added gradle data.

Module:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    testCompile 'junit:junit:4.12'
    compile 'com.google.firebase:firebase-auth:11.0.2'
}

apply plugin: 'com.google.gms.google-services'

Project

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.1.0'
    }
}
allprojects {
    repositories {
        jcenter()
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

1 Answer 1

2

Try this

  • Enable the authentication you are using in the console enter image description here

  • Add the internet permission to the manifest

Sign up to request clarification or add additional context in comments.

12 Comments

I've had email/password status enabled all the while. I added the internet permissions to manifest. But still getting same results.
The google services json file has been added under app folder and both gradle files been updated.
Check the logcat to see if it shows any warnings about firebase auth
Found follow error: "Local module descriptor class for com.google.firebase.auth not found."
Nice one. Thanks.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.