简体   繁体   English

地理编码器 getFromLocation 失败

[英]Geocoder getFromLocation failed

I'm trying to get placemarks from coordinates.我正在尝试从坐标中获取地标。

I'm using geoLocator for that.我正在为此使用geoLocator It was working fine today morning, but now, it throws platform exception.今天早上它工作正常,但现在,它抛出平台异常。

PlatformException(IO_ERROR, A network error occurred trying to lookup the supplied coordinates (latitude: <lat>, longitude: <long>)., null)

It says it's a.network error, but my device is connected to the inte.net,它说这是一个网络错误,但我的设备已连接到 inte.net,

First, i thought there might be some problem in the Geolocator package, so i used Geocoding package, but the problem persists.首先,我认为Geolocator package 可能有问题,所以我使用了Geocoding package,但问题仍然存在。

This is the error from geocoder.这是地理编码器的错误。

Geocoder getFromLocation --- mService = android.location.ILocationManager$Stub$Proxy@e8c2197, ex = grpc failed, return results = []

Please help.请帮忙。

See this flutter_geocoding issue (closed): https://github.com/Baseflow/flutter-geocoding/issues/23请参阅此 flutter_geocoding 问题(已关闭): https : //github.com/Baseflow/flutter-geocoding/issues/23

Two solutions presented:提出了两种解决方案:

  1. create a new emulator创建一个新的模拟器
  2. stop WiFi on the emulator, restart WiFi and let it find the network (AndroidWiFi)在模拟器上停止 WiFi,重新启动 WiFi 并让它找到网络(AndroidWiFi)

Solution 2 worked for me.解决方案 2 对我有用。

I had the same problem.我有同样的问题。 Try another emulator (create another emulator as if you are using another android or ios device).尝试另一个模拟器(创建另一个模拟器,就像您使用另一个 android 或 ios 设备一样)。 May be the current device that is being emulated is having problems connecting to the internet可能是正在模拟的当前设备连接到互联网时出现问题

try to add localeIdentifier parameter.尝试添加localeIdentifier参数。 works for me.为我工作。 my function code will be like我的功能代码会像

List<Placemark> newPlace = await GeocodingPlatform.instance.placemarkFromCoordinates(position.latitude, position.longitude,localeIdentifier: "en");

Try to WIPE DATA on your emulator.尝试在模拟器上擦除数据。 Restart it.重新启动它。

It works.有用。

这主要是由于您的设备位置发生了变化,如果您使用的是安卓手机等外部设备,那么您应该重新启动您的设备,它就会工作。

I've faced the same issue.我遇到过同样的问题。
Reason - The inte.net was not working inside my emulator.原因- inte.net 在我的模拟器中不工作。
Answer - If inte.net is not working inside your emulator, cold wipe your emulator from the virtual device manager and check again.回答- 如果 inte.net 在您的模拟器中不工作,请从虚拟设备管理器中冷擦除您的模拟器并再次检查。

It solved my issue.它解决了我的问题。

不知道是什么问题,但我最终制作了一个新的 android 模拟器(一个新的模拟设备),它运行良好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM