簡體   English   中英

地理編碼器 getFromLocation 失敗

[英]Geocoder getFromLocation failed

我正在嘗試從坐標中獲取地標。

我正在為此使用geoLocator 今天早上它工作正常,但現在,它拋出平台異常。

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

它說這是一個網絡錯誤,但我的設備已連接到 inte.net,

首先,我認為Geolocator package 可能有問題,所以我使用了Geocoding package,但問題仍然存在。

這是地理編碼器的錯誤。

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

請幫忙。

請參閱此 flutter_geocoding 問題(已關閉): https : //github.com/Baseflow/flutter-geocoding/issues/23

提出了兩種解決方案:

  1. 創建一個新的模擬器
  2. 在模擬器上停止 WiFi,重新啟動 WiFi 並讓它找到網絡(AndroidWiFi)

解決方案 2 對我有用。

我有同樣的問題。 嘗試另一個模擬器(創建另一個模擬器,就像您使用另一個 android 或 ios 設備一樣)。 可能是正在模擬的當前設備連接到互聯網時出現問題

嘗試添加localeIdentifier參數。 為我工作。 我的功能代碼會像

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

嘗試在模擬器上擦除數據。 重新啟動它。

有用。

這主要是由於您的設備位置發生了變化,如果您使用的是安卓手機等外部設備,那么您應該重新啟動您的設備,它就會工作。

我遇到過同樣的問題。
原因- inte.net 在我的模擬器中不工作。
回答- 如果 inte.net 在您的模擬器中不工作,請從虛擬設備管理器中冷擦除您的模擬器並再次檢查。

它解決了我的問題。

不知道是什么問題,但我最終制作了一個新的 android 模擬器(一個新的模擬設備),它運行良好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM