떼잉과병쯧
떼잉과병쯧

Reputation: 11

Local build fails because the SHA-1 key for Google login is not recognized

When I try to build a project locally in Android Studio, the login fails.

The error that occurs is:_LoginScreenState._onSignInWithGoogle:  PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null)
  1. The sha-1 key is registered.
  2. It is the same as the sha-1 key in the apk file.
  3. After regenerating the keystore, I registered a new sha-1 key.
  4. The released version is fine

Upvotes: 1

Views: 28

Answers (1)

ChillBroDev
ChillBroDev

Reputation: 312

Fingerprints and keystores are a very important concept in Android to understand. Let's break this down. I recommend you read through this App Signing page to better understand how this all works.

When we develop our application locally, Android Studio provides a unique keystore for debug builds. This has its own fingerprint that must be tracked.

Then when we build release builds of Android we must provide a release keystore that also has a separate fingerprint. That must be tracked for local development, otherwise Google Signin will reject auth attempts.

Finally, when we release builds to Google Play, there is another keystore that Google maintains and re-signs your app with. This fingerprint must also be specified to Google SignIn. More information can be found here.

Regenerating your keystore will not solve this issue.

To understand what fingerprints are being used by your local debug and release keystore, you can run this command in theandroid directory of your flutter app. ./gradlew signingreport. This will output all the fingerprints which you must register with Google Signin.

Upvotes: 0

Related Questions