[英]FireBase API Auth failure
我已经为Android Studio项目设置了Firebase用户身份验证。 经过一些测试,我最终得到以下错误
API:InternalFirebaseAuth.FIREBASE_AUTH_API在此设备上不可用。
从阅读开始,这听起来像Firebase的重复性错误。 Google是否有针对此问题的最新修复程序有更新,我可以找到的最新时间是2017年。
我已经在两个单独的设备(Amazon Kindle Fire HD和Xperia S)和一个模拟器上运行我的项目。 所有这些都存在相同的错误。
private void userLogin()
String email = emailText.getText().toString().trim();
String password = passwordText.getText().toString().trim();
mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
Intent intent = new Intent(sign_in.this, task_list.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
} else {
Toast.makeText(getApplicationContext(), task.getException().getMessage(), Toast.LENGTH_SHORT).show();
Log.e(TAG, "onComplete: Failed = " + task.getException().getMessage());
}
您必须检查其中之一。 1. SHA1提供给您的应用程序。 2.您的根应用程序上必须具有google-services.json。 3.配置您的依赖项。 4.确保启用了电子邮件/密码身份验证。 在Firebase控制台的“身份验证”标签中。
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:16.0.6'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
而这个在构建
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
}
}
allprojects {
// ...
repositories {
google() // Google's Maven repository
// ...
}
}
仅供参考。 您的代码没有错。 只是设置的事情。
请花一些时间来做。 不要跳过,不要着急。 您将比节省更多的时间
错误是由于使用Amazon kindle fire HD测试所致。 Kindle使用的FireOS没有Google Play服务,因此出现错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.