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

PlatformException when calling Geocoder.local.findAddressesFromQuery #29

Open
stevenosse opened this issue Aug 19, 2019 · 43 comments
Open
Labels
bug Something isn't working

Comments

@stevenosse
Copy link

Hello everybody!
I regularly use this plugin for building production applications; but i've recently been notified by a customer of a bug on an app, [...], below is the error shown in the console

E/flutter (12189): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(failed, Failed, null)
�[38;5;244mE/flutter (12189): #0      StandardMethodCodec.decodeEnvelope�[39;49m
�[38;5;244mE/flutter (12189): #1      MethodChannel.invokeMethod�[39;49m
E/flutter (12189): <asynchronous suspension>
�[38;5;248mE/flutter (12189): #2      LocalGeocoding.findAddressesFromQuery�[39;49m
E/flutter (12189): <asynchronous suspension>
�[38;5;248mE/flutter (12189): #3      HomePageState.searchByLocality�[39;49m
E/flutter (12189): <asynchronous suspension>
�[38;5;248mE/flutter (12189): #4      HomePageState.build.<anonymous closure>.<anonymous closure>�[39;49m
E/flutter (12189): <asynchronous suspension>
�[38;5;244mE/flutter (12189): #5      _InkResponseState._handleTap�[39;49m
�[38;5;244mE/flutter (12189): #6      _InkResponseState.build.<anonymous closure>�[39;49m
�[38;5;244mE/flutter (12189): #7      GestureRecognizer.invokeCallback�[39;49m
�[38;5;244mE/flutter (12189): #8      TapGestureRecognizer._checkUp�[39;49m
�[38;5;244mE/flutter (12189): #9      TapGestureRecognizer.acceptGesture�[39;49m
�[38;5;244mE/flutter (12189): #10     GestureArenaManager.sweep�[39;49m
�[38;5;244mE/flutter (12189): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent�[39;49m
�[38;5;244mE/flutter (12189): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent�[39;49m
�[38;5;244mE/flutter (12189): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent�[39;49m
�[38;5;244mE/flutter (12189): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue�[39;49m
�[38;5;244mE/flutter (12189): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket�[39;49m
�[38;5;244mE/flutter (12189): #16     _rootRunUnary  (dart:async/zone.dart:1136:13)�[39;49m
�[38;5;244mE/flutter (12189): #17     _CustomZone.runUnary  (dart:async/zone.dart:1029:19)�[39;49m
�[38;5;244mE/flutter (12189): #18     _CustomZone.runUnaryGuarded  (dart:async/zone.dart:931:7)�[39;49m
�[38;5;244mE/flutter (12189): #19     _invoke1  (dart:ui/hooks.dart:250:10)�[39;49m
�[38;5;244mE/flutter (12189): #20     _dispatchPointerDataPacket  (dart:ui/hooks.dart:159:5)�[39;49m
@aloisdeniel aloisdeniel added the bug Something isn't working label Aug 19, 2019
@biklas7
Copy link

biklas7 commented Aug 22, 2019

@aloisdeniel Do you have any updates on this? We are trying to use this package on a production app and we would like to avoid using google api for this.

@aloisdeniel
Copy link
Owner

Unfortunately I didn't have encounterd this issue yet ...

It may be linked to the system, on what device model did this happened ?

I suppose that you checked the user permission, right ?

@biklas7
Copy link

biklas7 commented Aug 22, 2019

I'm testing this on a Pixel 2. The app has location permissions. Do I need more permissions?

@stevenosse
Copy link
Author

stevenosse commented Aug 22, 2019

The weird thing is that it worked fine earlier... But it started crashing for no reason..
I was obliged to switch to bing geocoding

@biklas7
Copy link

biklas7 commented Aug 22, 2019

I'm also using open street maps which is not ideal, but it works.

@shinayser
Copy link

This is the error I'm getting:

Unhandled Exception: PlatformException(Error 10, kCLErrorDomain, A operação não pôde ser concluída. (kCLErrorDomain erro 10.))
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7)
#1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:316:33)
<asynchronous suspension>
#2      LocalGeocoding.findAddressesFromCoordinates (package:geocoder/services/local.dart:13:41)

Don't know if it is related but I am querying multiple addresses at the same time, asynchonously.

@bijoya-banik
Copy link

bijoya-banik commented Sep 3, 2019

Capture1
I want to convert latitude and longitude to formatted address. I worked with it before and it worked nicely.But don't know why it shows me this error now.

@g-balas
Copy link

g-balas commented Sep 12, 2019

@aloisdeniel I found how to reproduce the bug.

Using this coordinate works well : (43.184319, 5.324419)
Using this throws exception : (49.822816, -0.266805)

Unhandled Exception: PlatformException(not_available, Empty, null)

Seems like it does not accept negative lat/long

I though the bug was random at first because I was receiving differents GPS lat/lon from my server.
Then I notice that some works and others doesn't.

@SebastienBtr
Copy link

SebastienBtr commented Sep 23, 2019

Hi! any updates on this issue? Because right-now the plugin is unusable...

@arib7701
Copy link

arib7701 commented Oct 19, 2019

Hi guys. I am encountering this error too since this afternoon. It was working totally fine until one hour ago. I am using an emulator for a Pixel 2 on Ubuntu. However I tried on my real phone (Pixel) and here no error! So I updated everything and it's working on the emulator again! Hope this help someone!

@foxineo
Copy link

foxineo commented Oct 21, 2019

Capture1
I want to convert latitude and longitude to formatted address. I worked with it before and it worked nicely.But don't know why it shows me this error now.

got the same issue, any progress?

@fazil-augr
Copy link

Same error is happening in iOS when using findAddressesFromQuery.

PlatformException(Error 8, kCLErrorDomain, The operation couldn’t be completed. (kCLErrorDomain error 8.))

This will happens only in some queries.

var address= awaitGeocoder.local.findAddressesFromQuery(desc);

How to solve this issue.

@foxineo
Copy link

foxineo commented Oct 23, 2019

Same error is happening in iOS when using findAddressesFromQuery.

PlatformException(Error 8, kCLErrorDomain, The operation couldn’t be completed. (kCLErrorDomain error 8.))

This will happens only in some queries.

var address= awaitGeocoder.local.findAddressesFromQuery(desc);

How to solve this issue.

I just give up, and use the other plugin amap_location, it works fine.

@g-balas
Copy link

g-balas commented Nov 4, 2019

@aloisdeniel Any news ?

@fazil-augr
Copy link

I found the issue it happening in iOS only. Because IOS using apple map not google map. The only way is use Google API for retrieving details.

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input={keyword}&inputtype=textquery&fields=geometry&key={API_KEY}

@ASE55471
Copy link

I got error 10 by call Geocoder.local.findAddressesFromCoordinates, I found this error only happen on IOS .Every app started first call will work but If you call second time immediately will get this error.This happen to my app cuz for some reason I put Geocoder.local.findAddressesFromCoordinates in widget build function and somehow this widget rebuild immediately after first build.

@aloisdeniel
Copy link
Owner

aloisdeniel commented Nov 22, 2019

Sorry for not being very active lately.

I'm not sure if all of you have the exact same issue (you got different codes, and you have different OS).

In the meantime, as a workaround you can use the Google distant api via Geocoder.google instead of Geocoder.local (you will need an API key). This is an equivalent solution of @fazil-augr proposal.

@g-balas Thank you for finding it! I will see if I can reproduce.

@ClassSadStranger Triggering asynchronous calls from the build method is not recommended because it can be called multiple times in a row! You should store the Future in a StatefullWidget instead.

@g-balas
Copy link

g-balas commented Dec 12, 2019

Moving to https://pub.dev/packages/geolocator

@AresVampire
Copy link

geolocator has the same problem

@DennisSamul
Copy link

DennisSamul commented Dec 31, 2019

I had the same problem while using the emulator. But while using device, I dont have any problem.

I solved the emulator problem by opening the google maps and then running the app in emulator.

hope this helps some one from stop spending a lot of time like i did.

@Murys
Copy link

Murys commented Jan 7, 2020

Happened to have the same problem. In my case it was due to the fact that I was sending too many requests in a short time.
The requests were sent using the "onChanged" event of a TextField.

I solved the problem by using a Timer to send one single request 1 second after the user has stopped typing.

@lem-onade
Copy link

I had the same problem while using the emulator. But while using device, I dont have any problem.

I solved the emulator problem by opening the google maps and then running the app in emulator.

hope this helps some one from stop spending a lot of time like i did.

this worked for me in an emulator aswell, weirdly

@sunaarun
Copy link

I am facing the same problem , I have a collection with list of document and each document has a field type of Geopoint , some of them work fine and translate the latitude and longitude to address , but some of them , gime me this error PlatformException(failed, Failed, null) .. and I set a value for these fields , I don't know why

@Aminsteir
Copy link

I have also faced the same problem on my emulator and my physical device

@irchriscott
Copy link

I am also having the same problem but I realized that this error occurs when you are using Geocoder without internet. The problem is even if you put the code in try catch, it still raise the error

@Ciock
Copy link

Ciock commented Jul 16, 2020

For me the first call of Geocoder.local.findAddressesFromCoordinates(coordinates); is succesful, but then stop working.

In my case i have a page with a google map that shows the address every time the user stop move the map. When I open the page the address where the map is centered is retrieved correctly, then it throws the PlatformException(failed, Failed, null) at every later call.

It's strange that when i wrote the code everything worked well, then I closed the app and the emulator, relaunched it, and this error showed up

@buraktuntas
Copy link

Worked for me

Geocoder.google("APIKEY").findAddressesFromCoordinates(coordinates);

@Aminsteir
Copy link

Aminsteir commented Jul 19, 2020 via email

@BalaDhruv
Copy link

Guys. Same Error came for me in "GeoCoder" lib in android emulator. Set the default location in emulator settings. Then it will work fine.

@otopba
Copy link

otopba commented Sep 1, 2020

@stevenosse
@aloisdeniel
Hi guys! I have fixed it, please check
#47

@riskiadi
Copy link

@stevenosse
@aloisdeniel
Hi guys! I have fixed it, please check
#47

Still have the error

Screenshot_2

@otopba
Copy link

otopba commented Sep 23, 2020

@stevenosse
@aloisdeniel
Hi guys! I have fixed it, please check
#47

Still have the error

Screenshot_2

Did you use my fork?

@iwas-iwas
Copy link

iwas-iwas commented Oct 23, 2020

I still get these errors. is there no real fix yet? It always works again after waiting for some minutes. but that is unacceptable for production. I am using geocoder 0.2.1.

var address = await Geocoder.local.findAddressesFromQuery(p.description);

leads to:

Unhandled Exception: PlatformException(failed, Failed, null, null)

This occurs mostly only in the Android Emulator for me

@coder-with-a-bushido
Copy link

coder-with-a-bushido commented Oct 23, 2020

I still get these errors. is there no real fix yet? It always works again after waiting for some minutes. but that is unacceptable for production. I am using geocoder 0.2.1.

var address = await Geocoder.local.findAddressesFromQuery(p.description);

leads to:

Unhandled Exception: PlatformException(failed, Failed, null, null)

You could try one of the forks that fixes this issue from checking the pull requests section. For unknown reasons, it's still not being merged by the repository owner though. #47

@pedrojalbuquerque
Copy link

I had the same problem while using the emulator. But while using device, I dont have any problem.
I solved the emulator problem by opening the google maps and then running the app in emulator.
hope this helps some one from stop spending a lot of time like i did.

this worked for me in an emulator aswell, weirdly

Works for me too, in emulator, thanks a lot

@itec360
Copy link

itec360 commented Dec 16, 2020

Hi
I have issue in geocoder and other plugins but it installed in my pub.yaml

ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method findAddressesFromQuery on channel github.com/aloisdeniel/geocoder)

Please how to fix this ?

@iharshb
Copy link

iharshb commented Dec 23, 2020

I still get these errors. is there no real fix yet? It always works again after waiting for some minutes. but that is unacceptable for production. I am using geocoder 0.2.1.
var address = await Geocoder.local.findAddressesFromQuery(p.description);
leads to:
Unhandled Exception: PlatformException(failed, Failed, null, null)

You could try one of the forks that fixes this issue from checking the pull requests section. For unknown reasons, it's still not being merged by the repository owner though. #47

Still that fix has same bug for iOS platform

@YazeedAlKhalaf
Copy link

still sam bug, happened today, app was working 2 hours ago now it has the same exception weird

@khaledtechno
Copy link

i fixed this by using in gradle.properties:
android.enableDexingArtifactTransform=false
*it worked for me

@harshrocks
Copy link

Guys use flutter geocoder, It will work

@MonipichMP
Copy link

Worked for me

Geocoder.google("APIKEY").findAddressesFromCoordinates(coordinates);

this work for me

@Jigneshiosdeveloper
Copy link

Jigneshiosdeveloper commented Feb 16, 2022

I fixed this error below.

https://youtu.be/U_2XMFkZOBc

@ahsanlaeiq
Copy link

is this working fine in ios and how ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests