firebase - FirebaseAuth:getGoogleApiForMethod() 返回 Gms:com.google.firebase.auth.api.internal.zzal@489
问题描述
当我尝试进行电话身份验证时,我遇到了错误。
W/BiChannelGoogleApi(12340): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@489
我在 Stackverflow 和其他地方检查了相同的错误,但在任何地方都没有得到正确的解决方案。
pubspec.yml 中的更改
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
firebase_core: ^0.3.0+2 //new
firebase_auth: ^0.8.1+1 //new
注意 - 添加 //New 以突出显示我在上述文件中添加的行。
在app/build.gradle末尾添加以下行
apply plugin: 'com.google.gms.google-services'
安卓/build.gradle
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android/app/build.gradle
.....
android {
compileSdkVersion 28
.....
defaultConfig {
....
minSdkVersion 21
targetSdkVersion 27
......
}
.....
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-auth:16.1.0'
// implementation 'androidx.core:core-ktx:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
android/app/gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
我正在使用 AndroidX。
解决方案
我最近解决了这个问题。基本上这个错误有很多原因,因为当 FirebaseAuth 入口点执行失败时会返回这个错误。我遇到这个错误的原因之一是我的模拟器没有连接到互联网 所以也在模拟器内部打开互联网。
推荐阅读
- php - Android 中的 PHP 请求返回错误,但我不知道为什么
- wordpress - 如何在 Keycloak 中添加 Wordpress 作为身份提供者?
- c++ - 如何在 C++ 中将 mfc 对话框移动到屏幕外时维护加载的位图图像?
- php - mysql ınsert query dosen't workıng sometımes
- powershell - 使用 powershell 发送电子邮件,但某些收件人没有收到邮件
- xamarin.forms - Geolocation.GetLastKnownLocationAsync() 在 android 中不起作用
- java - 带有 sequence.nexval 的 Spring jdbc 插入语句
- html - 为革命滑块导航元素指定不同的样式
- c# - 具有单例依赖项的池 DbContext
- javascript - 如何在 Table ReacJst 中添加删除按钮功能?