[英]Firebase Authentication Error: I Enabled the Email/Password option
I'm trying to login to Firebase with Android, I'm getting strange messages: 我尝试使用Android登录到Firebase,但收到奇怪的消息:
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final String Email,Pass;
Email=email.getText().toString();
Pass=pass.getText().toString();
if(!TextUtils.isEmpty(Email) && !TextUtils.isEmpty(Pass))
{
progressBar.setVisibility(View.VISIBLE);
if(Pass.length()>=6)
{
auth = FirebaseAuth.getInstance();
auth.signInWithEmailAndPassword(Email, Pass).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task)
{
progressBar.setVisibility(View.INVISIBLE);
if (task.isSuccessful())
{
Intent i = new Intent(login.this, MainActivity.class);
i.putExtra("Email",Email);
startActivity(i);
finish();
}
else
{
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(login.this, "" + task.getException(), Toast.LENGTH_SHORT).show();
}
}
});
}
else
{
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(login.this, "Password Must be 8 Character Long", Toast.LENGTH_SHORT).show();
}
}
else
{
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(login.this, "Provide Email and Password", Toast.LENGTH_SHORT).show();
}
}
});
build.Gradle build.Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.butt************"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.google.firebase:firebase-database:11.8.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:27.0.1'
implementation 'com.android.support:recyclerview-v7:27.0.1'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
testImplementation 'junit:junit:4.12'
compile 'com.google.firebase:firebase-auth:11.8.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:27.0.1'
implementation 'com.android.support:cardview-v7:27.0.1'
implementation 'com.android.support:gridlayout-v7:27.0.1'
apply plugin: 'com.google.gms.google-services'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
With the Error Message: 与错误消息:
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms D/ViewRootImpl: Buffer Count from app info with ::-1 && -1 for :: com.butt.mediacalradar from View :: -1 DBQ Enabled ::false false W / BiChannelGoogleApi:[FirebaseAuth:] getGoogleApiForMethod()返回了Gms D / ViewRootImpl:来自应用信息的缓冲区计数,其中::: -1 && -1用于View的:: com.butt.mediacalradar :: -1启用了DBQ :: false false
"com.google.firebase.FirebaseException. An internal Error Occur [Bad Request]".
After Updating 更新后
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com**********"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//compile 'com.google.firebase:firebase-database:11.8.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:27.0.1'
implementation 'com.android.support:recyclerview-v7:27.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
testImplementation 'junit:junit:4.12'
compile 'com.google.firebase:firebase-auth:16.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:27.0.1'
implementation 'com.android.support:cardview-v7:27.0.1'
implementation 'com.android.support:gridlayout-v7:27.0.1'
apply plugin: 'com.google.gms.google-services'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
}
apply plugin: 'com.google.gms.google-services'
In order to make it work, please use the last versions for all your dependencies: 为了使其正常工作,请为所有依赖项使用最新版本:
First change google services version (build.gradle Project) to: 首先将Google服务版本(build.gradle Project)更改为:
classpath 'com.google.gms:google-services:4.0.1'
And the dependencies from: 并且依赖项来自:
compile 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
to 至
//compile 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
As you can see, the first line is commented. 如您所见,第一行被注释。 Don't also forget to delete the duplicate apply plugin: 'com.google.gms.google-services'
. 也不要忘记删除重复的apply plugin: 'com.google.gms.google-services'
。 Should remain only at the end of the file. 应该只保留在文件末尾。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.