Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRPC failed error during various method calls #223

Closed
1 of 2 tasks
MartinHlavna opened this issue Mar 6, 2019 · 23 comments
Closed
1 of 2 tasks

GRPC failed error during various method calls #223

MartinHlavna opened this issue Mar 6, 2019 · 23 comments
Labels
status: in progress Indicates that this issue is currently being worked on. status: triage Indicates that this issue needs to be analyzed and decorated with the appropriate labels type: documentation Update to the documentation

Comments

@MartinHlavna
Copy link

🐛 Bug Report

Hello, we sometimes run to the following problem using Geolocator. Method that throws error varies. This time, we managed to get some information during placemarkFromCoordinates call.


Error object


Error type: PlatformException
Error message: PlatformException(ERROR_GEOCODING_COORDINATES, grpc failed, null)


Device info:


Internet: wifi
version.securityPatch: 2018-12-01
version.sdkInt: 27
version.release: 8.1.0
version.previewSdkInt: 0
version.incremental: G390FXXU3BRL3
version.codename: REL
version.baseOS:
board: universal7570
bootloader: G390FXXU3BRL3
brand: samsung
device: xcover4lte
display: M1AJQ.G390FXXU3BRL3
hardware: samsungexynos7570
host: SWDH7002
id: M1AJQ
manufacturer: samsung
model: SM-G390F
product: xcover4ltexx
supported32BitAbis: [armeabi-v7a, armeabi]
supported64BitAbis: []
supportedAbis: [armeabi-v7a, armeabi]
tags: release-keys
type: user
isPhysicalDevice: true


Permission info:


calendar: unknown
camera: granted
contacts: unknown
location: granted
microphone: granted
phone: granted
photos: granted
reminders: granted
sensors: unknown
sms: unknown
storage: granted
speech: granted
locationAlways: granted
locationWhenInUse: granted
mediaLibrary: granted


Memory info:

Total physical memory: 1839 MB
Free physical memory: 35 MB
Total virtual memory: 3375 MB
Free virtual memory: 1184 MB

StackTrace

#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551)
#1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:292)
<asynchronous suspension>
#2      Geolocator.placemarkFromCoordinates (package:geolocator/geolocator.dart:251)
<asynchronous suspension>

Additional googling of error message showed this SO question pointing to two google bug reports (64418751, 64247769). Looks like there is problem with internal geolocation routines.

Expected behavior

Although this problem is caused by another problem in underlying structure, geolocator should not crash but should either

  • throw own specific exception that could be handled in consuming code as PlatformException is pretty general
  • or return null

Great alternative would be optional possibility to use Geocoding API web service

Reproduction steps

There is no clear reproduction manual. Only way we can experience it is by daily use of plugin. Sometimes it happens sometimes not.

Configuration

Version: 3.0.1

Platform:

  • 📱 iOS
  • 🤖 Android
@davicg
Copy link

davicg commented Mar 29, 2019

I think I'm facing a similar issue both on iOS and Android. In my application I'm requesting for a new placemark every time google maps camera moves, because I need to update the address displayed to the user. But after a few calls to placemarkFromCoordinates the geolocator plugin stops working, always returning the following error: PlatformException(ERROR_REVERSEGEOCODING_LOCATION, The operation couldn’t be completed.

@abumoallim
Copy link

I have same issue. It is working correcltly on emulators but not on real device.

@prasant10050
Copy link

i have also same issue both on ios and android

@abumoallim
Copy link

@prasant10050 I can give you a workaround with Javascript API calls. That's how I am using currently.

@prasant10050
Copy link

please fix this asap because i have already integrated this package into my production app.

@langerkirill
Copy link

@prasant10050 I can give you a workaround with Javascript API calls. That's how I am using currently.

Can you please add some more details about that workaround?

@mvanbeusekom mvanbeusekom added the status: triage Indicates that this issue needs to be analyzed and decorated with the appropriate labels label May 22, 2019
@ramioooz
Copy link

Hello developers,
I have been facing the same problem, but I think I do know what is happening here.
I was getting PlatformException : ERROR_GEOCODING_COORDINATES, grpc failed, null
every time I use geolocator.

I tried to change my ip address. I connect my phone to a vpn with USA ip address, and boom !!
geocoder now is working..

I think this has something to do with where you live... some google api services not available in some countries, so you need to connect through proxy or vpn to get them..

hope this help.
Thank you..

@Fernandomr88
Copy link

i'm using Google DNS (8.8.8.8) and it seems to be working good (I live in Brazil)

@crazyfree
Copy link

I also got same problem, kindly check. Thanks!

@geisterfurz007
Copy link

This generally seems to be an issue when calling some web API. I used this library from inside my companies network on an emulator and it failed. I ran the same code with the laptop connected to some other wifi that doesn't go through my companies proxy and the result came in almost instantly.

@sokolej79
Copy link

I also have issue with grpc failed. When turn off network and turn it on again then it almost always shows this error. Please fix this bug.

@StijnWoerkom
Copy link
Contributor

This issue depends on the location of the user itself. If your country doesn't support the connection to the Google Play Services, you can't establish a connection. As @ramioooz says, a VPN could help to establish a connection with the Google Play Services.

@StijnWoerkom StijnWoerkom added the type: documentation Update to the documentation label Oct 11, 2019
@MartinHlavna
Copy link
Author

@StijnWoerkom
Nice info. Although that may not be all the cases. In my original report I have stated that it happens only sometimes. @sokolej79 might have point with his network turning on and off as it may happen in cases when internet connection is temporary unavailable. Good application should handle this.

As I have proposed throwing new exception type would be great. Catching not very specific PlatformException may introduce hidden bugs where developers may also catch other PlatformExceptions they would want to handle differently.

Also, that exception message / or doccomments may also point developers that use this plugin to documentation link explaining issue with Google Play Services.

@StijnWoerkom
Copy link
Contributor

StijnWoerkom commented Oct 11, 2019

@MartinHlavna Thank you for your reply. We are always open-minded about introducing new methods of handling PlatformException. If you have thoughts about this subject you are always welcome to contribute to the plugin. I am still working on the documentation to explaining this issue about Google Play Services.

@StijnWoerkom StijnWoerkom added the status: in progress Indicates that this issue is currently being worked on. label Oct 11, 2019
@sokolej79
Copy link

From @StijnWoerkom:
"sokolej79 might have point with his network turning on and off as it may happen in cases when internet connection is temporary unavailable. Good application should handle this."
I use connectivity plugin and when turn off/on I dont allow user to get location again before network is turned on again. Dialog error block untill network is on again.

@sokolej79
Copy link

This error does not happens allways on same conditions. Only occasionally. Sometimes error happens only once other times when network is again and try multiple times to get location again error happens multiple times untill i restart the app.

@SirJulian
Copy link

@prasant10050 I can give you a workaround with Javascript API calls. That's how I am using currently.

Please share with us

@hasanhasanov
Copy link

hasanhasanov commented Dec 16, 2019

I did not receive an error when I changed or reinstalled the emulator or uninstall the app and try installing it again.

@aminnegahban73
Copy link

Do we always have to use VPN?

@sohameasternts
Copy link

sohameasternts commented Mar 11, 2020

facing same issue.

E/flutter (18757): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(ERROR_GEOCODING_COORDINATES, grpc failed, null)
E/flutter (18757): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (18757): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter (18757):
E/flutter (18757): #2 Geolocator.placemarkFromCoordinates (package:geolocator/geolocator.dart:256:59)
E/flutter (18757): #3 SplashScreenState._onLookupAddressPressed (package:squash_player/ui/splashscreen/splash.dart:284:10)
E/flutter (18757): #4 SplashScreenState.initGps. (package:squash_player/ui/splashscreen/splash.dart:401:11)
E/flutter (18757): #5 State.setState (package:flutter/src/widgets/framework.dart:1148:30)
E/flutter (18757): #6 SplashScreenState.initGps (package:squash_player/ui/splashscreen/splash.dart:395:7)
E/flutter (18757): #7 _asyncThenWrapperHelper. (dart:async-patch/async_patch.dart:73:64)
E/flutter (18757): #8 _rootRunUnary (dart:async/zone.dart:1134:38)
E/flutter (18757): #9 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (18757): #10 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
E/flutter (18757): #11 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
E/flutter (18757): #12 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
E/flutter (18757): #13 Future._completeWithValue (dart:async/future_impl.dart:524:5)
E/flutter (18757): #14 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:32:15)
E/flutter (18757): #15 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:290:13)
E/flutter (18757): #16 Geolocator.getLastKnownPosition (package:geolocator/geolocator.dart)
E/flutter (18757): #17 _asyncThenWrapperHelper. (dart:async-patch/async_patch.dart:73:64)
E/flutter (18757): #18 _rootRunUnary (dart:async/zone.dart:1134:38)
E/flutter (18757): #19 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (18757): #20 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
E/flutter (18757): #21 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
E/flutter (18757): #22 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
E/flutter (18757): #23 Future._completeWithValue (dart:async/future_impl.dart:524:5)
E/flutter (18757): #24 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:32:15)
E/flutter (18757): #25 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:290:13)
E/flutter (18757): #26 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart)
E/flutter (18757): #27 _asyncThenWrapperHelper. (dart:async-patch/async_patch.dart:73:64)
E/flutter (18757): #28 _rootRunUnary (dart:async/zone.dart:1134:38)
E/flutter (18757): #29 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
E/flutter (18757): #30 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
E/flutter (18757): #31 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
E/flutter (18757): #32 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
E/flutter (18757): #33 Future._completeWithValue (dart:async/future_impl.dart:524:5)
E/flutter (18757): #34 Future._asyncComplete. (dart:async/future_impl.dart:554:7)
E/flutter (18757): #35 _rootRun (dart:async/zone.dart:1126:13)
E/flutter (18757): #36 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter (18757): #37 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
E/flutter (18757): #38 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:965:23)
E/flutter (18757): #39 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
E/flutter (18757): #40 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)

@sunaarun
Copy link

Facing the same issue , I have a collection in firestore and this collection has 6 documents , and trying to fetch lat, lon for each document and translate it to address , 4 of them works fine but 2 of them giving me this error , I don't know why ?
Can any one help me please ?

@AshrafZarkani
Copy link

I restarted my Device and it worked fine , same as #259 ticket solution provided by @alnaughty

@mvanbeusekom
Copy link
Member

Since version 6.0.0 the geocoding features are no longer part of the geolocator plugin and moved to their own plugin which can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in progress Indicates that this issue is currently being worked on. status: triage Indicates that this issue needs to be analyzed and decorated with the appropriate labels type: documentation Update to the documentation
Projects
None yet
Development

No branches or pull requests