Reputation: 4199
When I am trying to phone authntication I am getting below error.
W/BiChannelGoogleApi(12340): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@489
I have checked the same error in Stackverflow and other places but not getting proper solution anywhere.
chnages in 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
Note -- added //New to highlite the lines which i have added in above file.
Added below line at the end of app/build.gradle
apply plugin: 'com.google.gms.google-services'
android/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
I am using AndroidX.
Upvotes: 17
Views: 33854
Reputation: 151
I recently solved this issue. Basically there are many reason for this this error because this error returns when FirebaseAuth entry point failed to execute. One of the reason of getting this error which I faced is My Emulator was't connected to Internet So turn the internet on inside emulator also.
Upvotes: 15
Reputation: 151
I tried everything, this error cost me around three hours, just to make sure if you are trying to send OTP from emulator it will not work since it requires a network, just something else you can check. Good luck!!
Upvotes: 0
Reputation: 847
Maybe it's late for your solution, but in my case was just no WiFi connection in testing device (Emulator)
Upvotes: 0
Reputation: 453
Something must have gone wrong on my emulator. I simply ran the app on a new emulator and it worked just fine. It also ran fine on my device.
Upvotes: 0
Reputation: 57
If you are going with the phone authentication, please check whether you are providing the country code or not. That worked for me.
Upvotes: 1
Reputation: 1476
Weird behaviour, Using android Emulator, connected with firebase when using phone keyboard its working fine but using my PC keyboard, facing this issue
Upvotes: 0
Reputation: 1
I got same error while I was trying to make Email/Password authentication and lost few hours, Finally realized that I didn't Enable Email/Password authentication in firebase account.
Upvotes: 0
Reputation: 1
W/BiChannelGoogleApi(12340): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@489
These types of error codes are pretty much useless. Try
Log.i("flag", "signInAnonymously:failure", task.exception)
inside the auth.createUserWithEmailAndPassword or similar method.
When authenticating google will look for a password with at least more than 6 characters.
You can see some examples here: https://github.com/firebase/quickstart-android/tree/master/auth
Upvotes: 0
Reputation: 21
I have solved this problem. i have a cleared solution of it
follow the steps:
2.second thing is: phone number is in the format of +countrycode then phonenumber(like +918282.....).
hope this is helpful
Upvotes: 1
Reputation: 21
I had this error and i couldn't connect with email/password after updating my libraries in my pubspec.yaml file.
To resolve this error, I also updated my gradle file (build.grade) :
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
and my gradle-wrapper.properties file, I updated the following line :
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
Upvotes: 2
Reputation: 11
Its because "oncomplete listener " which automatically verified that phone number are correct. Its internal API but we want sms verification. So it will not send sms on that number on which app is installed. Send to another device number, it will work definitely
Upvotes: 1
Reputation: 201
In my case, I was just being lazy and using a 3 character long password. I don't know If this may help someone else one day.🤷🏾♂️
Upvotes: 1
Reputation: 9734
For me I got this stacktrace
getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@a73de51
I forgot to enable the Sign-In Provider
in the Firebase Console. I solved it after enabling Phone Provider
under the sign-in method tab of Authentication Section.
Also I got another kind of same error
getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@a73de51 I/flutter ( 2870): The format of the phone number provided is incorrect.
Initially I sent only mobile number without country code. Then I just sent the phone number with country code.
For example : +91 8811111111
It worked perfectly.
Upvotes: 2
Reputation: 539
This is a dependency issue, you may want to review your firebase setup again. I ran through a flutter app, and had the same exact issue.
Upvotes: 1
Reputation: 138841
I lost a few hours on this one, so let me share my experience on this.
Gms stands for "Google Mobile Services", and its basically an addon API to Android developed by Google that allows to connect to a bunch of Google-provided services. If you use flutter, this is probably wrapped by flutter packages you use such as firebase_auth, flutter_facebook_login or/and google_sign_in.
This error may sometimes be handled by the higher level components, so if you have that error, it doesn't mean your configuration is wrong or it won't work. In my case I had this error with successful end result when I was logging using Google Sign in, something like this:
info flutter.tools W/BiChannelGoogleApi( 4106): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@8116b2c
info flutter.tools D/FirebaseAuth( 4506): Notifying id token listeners about user ( lCZZZZJELWhGUZZZZB3vDklZZZZ2 ).
info flutter.tools D/FirebaseAuth( 4506): Notifying auth state listeners about user ( lCZZZZJELWhGUZZZZB3vDklZZZZ2 ).
info flutter.tools I/flutter ( 4506): FirebaseUser({uid: lCZZZZJELWhGUZZZZB3vDklZZZZ2, photoUrl: https://lh5.googleusercontent.com/-ZZzir_P-ENw/AAAAAAAAAAI/AAAAAAAAAAA/PpxhiXg_ISk/s96-c/photo.jpg, isAnonymous: false, etc....
I have a dart call print(fireUser);
in my code so we see it's a success.
But in the case of Facebook Auth, I just had this, and nothing happened after that, but on the Facebook server side, login was succeeding as I could see events in Facebook dev console.
info flutter.tools W/BiChannelGoogleApi( 4106): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@8116b2c
And nothing else after in the log, so something was stuck in the process.
My problem was I mixed two applications App Id and Secret. I'm a bonehead sometimes, but the thing is there's zero warning or specific error nowhere, so here are a list of things that can fail with Firebase and other plugins:
In the specific case of Facebook Auth (I find Google Sign In much easier to integrate):
Hope this helps
Upvotes: 6
Reputation: 1909
I had this error but it happened because I was trying to create an account with same email on my app, I had to remove the account from database and authentication.
My returned code is a little different from yours.
[FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal@**5bfaa19**
Upvotes: 5
Reputation: 555
This might be due to an incompatible version of google play services on your testing device.
If it is an emulator, try switching to another image and check if you are on the lastest version of play services.
Note that only Android N (API 24) and above supports update of play services via playstore.
Upvotes: 3