android - Firebase 身份验证注册时出现电话号码错误
问题描述
我正在使用 Firebase 身份验证使用电话号码进行注册。但是没有发送任何短信。
我收到此错误
W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() 返回 Gms: com.google.firebase.auth.api.internal.zzak@d5a4a6d
我的毕业档案
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'com.google.android.material:material:1.1.0-alpha07'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0-alpha01'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.13-beta-3'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01'
}
解决方案
我了解到您错过了在您的应用程序中设置 Firebase。
从这里跟踪整个过程
确保您的应用程序的模块(应用程序级)目录中有google-services.json文件。
您的根级(项目级)Gradle 文件 (build.gradle) 必须包含这些行。
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.2.0' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
然后在你的模块(应用级)Gradle 文件(通常是 app/build.gradle)中,在文件底部添加一行。
apply plugin: 'com.android.application'
android {
// ...
}
// Add the following line to the bottom of the file:
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
在您的模块(应用级)Gradle 文件(通常是 app/build.gradle)中,添加核心 Firebase SDK 的依赖项:
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:17.0.0'
// Getting a "Could not find" error? Make sure that you've added
// Google's Maven repository to your root-level build.gradle file
}
推荐阅读
- c# - 禁用与 UWP 应用的键盘交互
- javascript - 嵌套 Firebase 查询
- machine-learning - 机器学习中的训练和测试数据
- android - 如何使用 OnsavedInstance 保存 Spinner 及其适配器并在之后恢复它?
- excel - 等于设置 range1 到 range2
- android - 无法使用 Android MP 图表库在条形图上显示叠加
- google-chrome - 开发新手,想要做一个标记特定亚马逊产品的扩展,怎么做?
- python - 使用 PyQt 和 QML 的控制台中的 QOpenGLShaderProgram 链接错误
- excel - 比较两列之间的重复项
- android - Android 应用程序:发起 Skype 通话并在通话结束后关闭 Skype