地理coder.getFromLocation抛出异常抛出、异常、地理、getFromLocation

由网友(地獄)分享简介:可能重复: Geo$c$cr.getFromLocation抛出IOException异常在Android模拟器 我使用谷歌API 7,Android2.1的模拟器I am using Google api 7, Android2.1 emulator我试图做反向地理编码和我:I am trying to d...

可能重复:   Geo$c$cr.getFromLocation抛出IOException异常在Android模拟器

我使用谷歌API 7,Android2.1的模拟器

I am using Google api 7, Android2.1 emulator

我试图做反向地理编码和我:

I am trying to do reverse geocoding and I get:

03-07 16:19:42.661:WARN / System.err的(261):产生java.io.IOException:无法解析来自服务器的响应

03-07 16:19:42.661: WARN/System.err(261): java.io.IOException: Unable to parse response from server

在该行:

      List<Address> addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);

任何想法?

谢谢, 射线。

推荐答案

请注意,当你调用该方法,它触发了一个API调用谷歌地图服务器 - 它不是在设备上这样做。我怀疑这是一个错误,你将看到有时,因为该方法不管理,以获得从谷歌地图API的一个有意义的反应。我用这个方法,我偶尔会看到错误,但我通常把方法变成10重试循环,静静地忽略偶尔的错误。如果它发生在每次调用该方法时,有一些奇怪的事情发生。

Do note that when you call that method, it fires off an API call to Google Maps' servers - it isn't doing it on the device. I suspect this is an error you will see sometimes, because the method is not managing to get a meaningful response from the Google Maps API. I've used this method and I occasionally see that error, but I usually put the method into a loop of 10 retries, and quietly ignore the occasional error. If it's happening every time you call the method, there's something odd happening

阅读全文

相关推荐

最新文章