Flutter: (24658): PlatformException(network_error, com.google.android.gms.common.api.ApiException: 7: , null, null)

1,113

Solution 1

You are probably now building a release version to install on the emulator in Android Studio, but you don't have the release sha-1 shared with Firebase. Add all three sha-1 to Firebase: Debug and Release sha-1 from Android Studio, and sha-1 from the Play Store. Then download and install the new google-services.json from Firebase and add it to your android/app folder. Then clean and rebuild your app. All versions of your app should then work with Firebase and Google sign in.

Solution 2

Sometime This kind of error because of network permission not inserted in AndroidManifest.xml file Put below line in AndroidManifest.xml file

<uses-permission android:name="android.permission.INTERNET" />

Also check working internet connection of mobile data or wifi.

Solution 3

Please verify the date and time. Sometimes wrong date & time are set on emulators.

Share:
1,113
Ashok
Author by

Ashok

Updated on December 30, 2022

Comments

  • Ashok
    Ashok over 1 year

    Short Summary: This app works on a physical android phone. However, when we try to make it work on the emulator, Google Sign In does not work. Please see the details below:

    Details:

    1. We have created a Flutter app to share information to our internal team.

    2. Pre Google Play Store Update: At the start, we connected Firebase to the app. Added the debug SHA 1 key to Firebase. Google Sign-In works as expected in both the emulator and phone.

    3. Post Google Play Store release: a. List item

      a. We deleted the debug SHA1 from Firebase and changed the SHA1 key to the key which Google Play store gives us.

      b. Downloaded the new google-services.json from Firebase and added it to our androip/app folder. The Google Sign in Works on the Phone but does not work via the Emulator. We get the following error:

    I/flutter (24658): PlatformException(network_error,com.google.android.gms.common.api.ApiException: 7: , null, null)

    We re-added the Debug SHA1, and Debug SHA256 keys to Firebase. Still, Google Sign in does not work on the Emulator. But works properly in the Phone.

    1. Checked about 7 previous StackOverflow response, but most responses are for PlatformException(sign_in_failed...) or other reasons, but not for PlatformException(network_error...) . examples of solutions tried:

      Google sign in failed com.google.android.gms.common.api.ApiException: 10:

      Generate SHA-1 for Flutter/React-Native/Android-Native app

    2. Internet permissions is enabled in the AndroidManifest.xml

    Please let us know if any code is to be shared to analyse the issue better and we will share it.

    Thank you in advance.