8

I am new in Flutter. I face a problem about [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException.

Here is my Debug Console:

Launching lib\main.dart on sdk gphone x86 in debug mode...
lib\main.dart:1
√  Built build\app\outputs\flutter-apk\app-debug.apk.
W/FlutterActivityAndFragmentDelegate(10702): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
Connecting to VM Service at ws://127.0.0.1:59535/02E90npmd4s=/ws
E/flutter (10702): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(network_error, com.google.android.gms.common.api.ApiException: 7: , null, null)
E/flutter (10702): #0      StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:607
E/flutter (10702): #1      MethodChannel._invokeMethod
package:flutter/…/services/platform_channel.dart:156
E/flutter (10702): <asynchronous suspension>
E/flutter (10702): #2      MethodChannel.invokeMapMethod
package:flutter/…/services/platform_channel.dart:356
E/flutter (10702): <asynchronous suspension>
E/flutter (10702): #3      GoogleSignIn._callMethod
package:google_sign_in/google_sign_in.dart:244
E/flutter (10702): <asynchronous suspension>
E/flutter (10702): #4      GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart)
E/flutter (10702): <asynchronous suspension>
E/flutter (10702):

How do I fix it?

My Car
  • 4,198
  • 5
  • 17
  • 50

3 Answers3

6

This error is caused when you are not connected to internet. Check your internet connection and try again.

  1. Check if you have added INTERNET permissions in the androidManifest file.
  2. From the logs I can see that you are using google_sign_in so make sure you have uploaded the SHA-1 to the Firebase console. If not then add the SHA-1 key and replace your google-service.json file with new one.
  3. If running on an emulator check if the emulator can access the internet. More on this here.
My Car
  • 4,198
  • 5
  • 17
  • 50
Ashutosh Patole
  • 926
  • 1
  • 7
  • 23
1

Tried Everything then Found this Solution by myself

  1. Open Settings in your Emulator
  2. Then Open Location settings
  3. Click on "Apps Access to Location"
  4. Select your App from the List of other apps asking for location permission 5.Select any of the First Two Options.

Tested Solution

1

google is rejecting your request because your API is not enabled, enable maps SDK for android and IOS, then add your API key in the AndroidManifest.xmlas shown in the image

ojoago
  • 61
  • 4