且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我收到此错误:“指定的身份验证提供程序未启用此Firebase”,即使我已启用所需的提供程序

更新时间:2023-12-05 21:45:10

您的代码看起来像是使用了旧的(< 3.0.0)版本的Firebase,因此您可能需要在 https://www.firebase.com/login/ 上使用旧版控制台而不是Firebase 3控制台。或者,您可以使用Firebase 3创建密码帐户: https ://firebase.google.com/docs/auth/android/password-auth#create_a_password-based_account


Please, someone help me. I just cannot understand what's going wrong! And I have also included the google-services.json file in the app folder. Please, any help is really really appreciated. I'm kinda going pretty mad about this.

And the error is specifically:

I/System.out: The specified authentication provider is not enabled for this Firebase.

This is my MainActivity.java class:

public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Firebase mRef = new Firebase("https://<my-project>.firebaseio.com/");
            mRef.createUser("bobtony@firebase.com", "correcthorsebatterystaple", new Firebase.ValueResultHandler<Map<String, Object>>() {
            @Override
            public void onSuccess(Map<String, Object> result) {
                System.out.println("Successfully created user account with uid: " + result.get("uid"));
            }
            @Override
            public void onError(FirebaseError firebaseError) {
                // there was an error
                System.out.println(firebaseError.getMessage());
            }
        });
    }
}

FirebaseActivity.java class:

public class FirebaseActivity extends android.app.Application{
    @Override
    public void onCreate() {
        super.onCreate();
        Firebase.setAndroidContext(this);
        // other setup code
    }

}

.

Manifest:

<uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:name=".FirebaseActivity"
        android:theme="@style/AppTheme" >
        <activity android:name=".MainActivity" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

build.gradle (app):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "<myId>"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.firebase:firebase-client-android:2.3.1'
    compile 'com.google.firebase:firebase-core:9.0.0'
    compile 'com.google.firebase:firebase-database:9.0.0'
}
apply plugin: 'com.google.gms.google-services'

build.grade (project):

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And also, this is Sign-in method tab:

http://i.imgur.com/rGXrj9S.png

If you'r still looking at this, I appreciate you taking time to read this. Please, a little help.

Your code looks like it's using an old (< 3.0.0) version of Firebase, so you may need to use the legacy console at https://www.firebase.com/login/ instead of the Firebase 3 console. Alternatively, this is how you create a password account with Firebase 3: https://firebase.google.com/docs/auth/android/password-auth#create_a_password-based_account