我收到此错误:“指定的身份验证提供程序未启用此Firebase”,即使我已启用所需的提供程序 [英] I'm getting this error: "The specified authentication provider is not enabled for this Firebase.", even though I HAVE enabled the required providers
问题描述
这个错误是特别的:
I / System.out:指定的身份验证提供程序未启用此Firebase。
这是我的MainActivity.java类:
public class MainActivity extends AppCompatActivity {
$ p
$ b $ @Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate (savedInstanceState);
setContentView(R.layout.activity_main);
Firebase mRef =新的Firebase(https://< my-project> .firebaseio.com /);
mRef.createUser(bobtony@firebase.com,correcthorsebatterystaple,new Firebase.ValueResultHandler< Map< String,Object>>(){
@Override
public void onSuccess (< String,Object>结果){
System.out.println(用uid成功创建用户帐户:+ result.get(uid));
}
@Override
public void onError(FirebaseError firebaseError){
//出现错误
System.out.println(firebaseError.getMessage());
}
}) ;
$ / code $ / pre
$ b $ p FirebaseActivity.java class:
public class FirebaseActivity extends android.app.Application {
@Override
public void onCreate(){
super。的onCreate();
Firebase.setAndroidContext(this);
//其他设置代码
}
}
<
清单:
< uses-permission android :name =android.permission.INTERNET/>
应用程序$ b $ 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>
< category android:name =android.intent.category.LAUNCHER/>
< / intent-filter>
< / activity>
< / application>
build.gradle(app):
<$应用插件:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion23.0.3
defaultConfig {
applicationId< myId>
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName1.0
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
}
依赖关系{
编译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):
$ p $buildscript {
存储库{
jcenter()
}
依赖关系{
classpath'com.android.tools.build:gradle:2.1.0'
classpath'com.google.gms:google-services:3.0.0'
//注意:不要在这里放置您的应用程序依赖项它们属于单个模块build.gradle文件中的
//
}
}
allprojects {
repositories {
jcenter()
任务清理(类型:删除){
删除rootProject.buildDir
}
另外,这是Sign-in方法标签:
http://i.imgur.com/rGXrj9S.png
如果你仍然在看这个,我感谢你花时间阅读这个。请帮助一下。
您的代码看起来像是使用了旧的(< 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
这篇关于我收到此错误:“指定的身份验证提供程序未启用此Firebase”,即使我已启用所需的提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!