Flutter, Firebase Google sign in error - I/flutter ( 5171): PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10:

161 views Asked by At

I have been having issues with signing in to google on a flutter app I am trying to develop. I keep on getting the same error on my debug console which is -

I/flutter ( 5171): PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)

I have updated my SHA-1 and SHA-2 keys on my firebase console, which took me ages to find as the command line commands

keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
keytool -list -v -keystore path-to-your-release-key.keystore -alias your-key-alias -storepass your-keystore-password -keypass your-key-password

show up with the following errors

keytool error: java.lang.Exception: Keystore file does not exist: ~/.android/debug.keystore
java.lang.Exception: Keystore file does not exist: ~/.android/debug.keystore
        at java.base/sun.security.tools.keytool.Main.doCommands(Main.java:923)
        at java.base/sun.security.tools.keytool.Main.run(Main.java:423)
        at java.base/sun.security.tools.keytool.Main.main(Main.java:416)
keytool error: java.lang.Exception: Keystore file does not exist: path-to-your-release-key.keystore
java.lang.Exception: Keystore file does not exist: path-to-your-release-key.keystore
        at java.base/sun.security.tools.keytool.Main.doCommands(Main.java:923)
        at java.base/sun.security.tools.keytool.Main.run(Main.java:423)
        at java.base/sun.security.tools.keytool.Main.main(Main.java:416)
PS C:\Users\marsd> 

Im stuck and don't know what to do, any help would be greatly appreciated

1

There are 1 answers

3
Joe Clarence On

The documentation is pretty poor and I also got this problem while generating the jks file. I found a solution though. You'll need to replace the 'path' with an actual path in your device. Something like this.

keytool -genkey -v -keystore C:\Users\WINDOWS\debug-key.jks 
-storetype JKS -keyalg RSA -keysize 2048 -validity 10000 
-alias androiddebugkey

C:\Users\WINDOWS\ represents the folder's path, while debug-key represents the name for the jks file. Meanwhile, androiddebugkey is the name of the alias. For the alias, you can name it whatever you want.

After setting up the command properly, the command line will ask for the password, which you are required to fill, and after that private info such as first name, address, etc. You can choose to ignore the latter though by just hitting the enter key.

Once the jks file is generated, make sure to go to the folder you specified in the command then copy it. Paste it in the android/app directory in your Flutter project. Then go to android/app/build.gradle, update the signingConfigs and buildTypes section like this.

signingConfigs {
    debug {
        keyAlias 'the alias you specified'
        keyPassword 'the key password you inserted'
        storeFile file('"name of the file".jks')
        storePassword 'the store password you inserted'
    }
}

buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
}

You need to modify accordingly based on the information you inserted in the command line. Note that this is just for the debug mode. For release mode you will need to repeat the entire step, and replace the debug { with release {.

Hope this helps your case.