Flutter/Firebase Google login not working after building apk file

前端 未结 2 1872
不思量自难忘°
不思量自难忘° 2021-01-15 08:37

I have made android app that uses firebase and google_sign. Then I have release apk by flutter build apk. But after installing that apk file locally in my phone the google l

相关标签:
2条回答
  • 2021-01-15 09:17

    This is a late answer, but the debug and even the prod signing key that you use on your local machine to create the APK won't work if you use AppBundle or Google App Signing (which is the norm now unless you opt out).

    For Production apps go to Google Play Console. Click your app, click Release Management -> App Signing. Then look under App signing certificate here you can copy the SHA1 to your firebase console under Project Settings -> SHA certificate fingerprints.

    This is because your upload key is swapped out on the google servers when you upload your APK / AppBundle. Meaning that your production app served to users from the play store has a different SHA1 fingerprint than anything on your local machine (including your signing keys) thats why they dont work when going live but work while debugging locally.

    0 讨论(0)
  • 2021-01-15 09:18

    In your console use the command after entering android folder using

    cd android
    
    gradlew signinReport
    

    This command generates certificates and SHA keys which you need. When we first create Firebase, we give the SHA debug key which no longer works in production version.

    Go to the project settings in Firebase console and change the SHA field with the release key generated using the above command.

    Keep in mind, this command generates a bunch of keys including debug and release keys. You need the release one.

    0 讨论(0)
提交回复
热议问题