Java.io.IOException: Unable to parse response from server - Geocoder Android

I use the geocoder class to find the latitude and longitude from the address bar.

Here is my code:

geocoder=new Geocoder(FindFishActivity.this); try { List<Address>foundLake=geocoder.getFromLocationName(strSearch,2); if(foundLake.size()==0) { Toast.makeText(this,"Sorry,could not find data",Toast.LENGTH_LONG); } else { for(int i=0;i<foundLake.size();i++) { Address address=foundLake.get(i); lat=address.getLatitude(); lon=address.getLongitude(); Log.i("Lakes",""+lat+""+lon); navigateToLocation((lat * 1000000), (lon * 1000000), mapview); } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } 

Here is the error:

 08-19 10:13:33.940: WARN/System.err(25910): java.io.IOException: Unable to parse response from server 08-19 10:13:33.945: WARN/System.err(25910): at android.location.Geocoder.getFromLocationName(Geocoder.java:178) 08-19 10:13:33.945: WARN/System.err(25910): at com.amt.android.garage.Garage.postData(Garage.java:272) 08-19 10:13:33.945: WARN/System.err(25910): at com.amt.android.garage.GarageForm$2.onClick(GarageForm.java:86) 08-19 10:13:33.945: WARN/System.err(25910): at android.view.View.performClick(View.java:2538) 08-19 10:13:33.945: WARN/System.err(25910): at android.view.View$PerformClick.run(View.java:9152) 08-19 10:13:33.945: WARN/System.err(25910): at android.os.Handler.handleCallback(Handler.java:587) 08-19 10:13:33.945: WARN/System.err(25910): at android.os.Handler.dispatchMessage(Handler.java:92) 08-19 10:13:33.950: WARN/System.err(25910): at android.os.Looper.loop(Looper.java:123) 08-19 10:13:33.950: WARN/System.err(25910): at android.app.ActivityThread.main(ActivityThread.java:3691) 08-19 10:13:33.955: WARN/System.err(25910): at java.lang.reflect.Method.invokeNative(Native Method) 08-19 10:13:33.955: WARN/System.err(25910): at java.lang.reflect.Method.invoke(Method.java:507) 08-19 10:13:33.955: WARN/System.err(25910): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847) 08-19 10:13:33.955: WARN/System.err(25910): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605) 08-19 10:13:33.955: WARN/System.err(25910): at dalvik.system.NativeStart.main(Native Method) 

And I don’t understand why. Can someone tell me something?

+2
java android
Aug 19 2018-11-11T00:
source share
1 answer

Is this a constant problem? IOException may indicate that the remote request failed for some relatively low-level reason; and docs confirm this:

throws IOException if the network is unavailable or any other input / output problem occurs

In any case, this does not seem to be a problem with how you call this method - perhaps the device didn’t receive / connect at that time?

+5
Aug 19 2018-11-11T00: 00Z
source share



All Articles