arthiks
arthiks

Reputation: 31

Unable to create new user on Firebase

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
}

Upvotes: 2

Views: 326

Answers (1)

Martin De Simone
Martin De Simone

Reputation: 2148

Try this

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

  • Add the internet permission to the manifest

Upvotes: 2

Related Questions