Android java.io.IOException:无法分析来自getFromLocation服务器的响应

Android java.io.IOException:无法分析来自getFromLocation服务器的响应,android,geolocation,geocoding,Android,Geolocation,Geocoding,在我的应用程序中,我需要当前位置。我成功地得到了纬度和经度。现在,我想从这一段中填写地址。这是我的密码: double latitude = gps.getLatitude(); double longitude = gps.getLongitude(); // \n is for new line Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + lat

在我的应用程序中,我需要当前位置。我成功地得到了纬度和经度。现在,我想从这一段中填写地址。这是我的密码:

double latitude = gps.getLatitude();
        double longitude = gps.getLongitude();

        // \n is for new line
        Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();    

        System.out.println("$$$$$$"+latitude+":::"+longitude);

        Geocoder geocoder;
        List<Address> addresses;
        geocoder = new Geocoder(this, Locale.getDefault());
        try {
            addresses = geocoder.getFromLocation(latitude, longitude, 1);

            String address = addresses.get(0).getAddressLine(0);
            String city = addresses.get(0).getAddressLine(1);
            String country = addresses.get(0).getAddressLine(2);                
            String fullAdd = address+":"+city;      

            sendSMS(IncomingCallReceiver.phonenumber,fullAdd);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            String fullAdd = "Latitude:"+latitude+",Longitude:"+longitude;              

            sendSMS(IncomingCallReceiver.phonenumber,fullAdd);
        }

堆栈后跟踪。及logs@njzk2,实际上我想要的是,如果我遇到异常,我想调用getFromLocation 10次。在我的问题中,我添加了logcat。如果您得到一次异常,我猜您第二次也会有异常,如果您使用相同的参数调用相同的服务,我认为异常是因为网络问题。所以它可能在几秒钟后网络可用,我会得到正确的位置。在这篇文章中,接受ans是我想要的东西-
04-26 14:54:35.359: W/System.err(11976): java.io.IOException: Unable to parse response from    server
04-26 14:54:35.359: W/System.err(11976):    at     android.location.Geocoder.getFromLocation(Geocoder.java:136)
04-26 14:54:35.359: W/System.err(11976):    at com.example.locationtracker.LocationService.getLocation(LocationService.java:88)
04-26 14:54:35.359: W/System.err(11976):    at com.example.locationtracker.LocationService.onStart(LocationService.java:45)
04-26 14:54:35.359: W/System.err(11976):    at android.app.Service.onStartCommand(Service.java:428)
04-26 14:54:35.359: W/System.err(11976):    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2043)
04-26 14:54:35.359: W/System.err(11976):    at android.app.ActivityThread.access$2800(ActivityThread.java:117)
04-26 14:54:35.359: W/System.err(11976):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:998)
04-26 14:54:35.359: W/System.err(11976):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-26 14:54:35.359: W/System.err(11976):    at android.os.Looper.loop(Looper.java:130)
04-26 14:54:35.359: W/System.err(11976):    at android.app.ActivityThread.main(ActivityThread.java:3687)
04-26 14:54:35.359: W/System.err(11976):    at java.lang.reflect.Method.invokeNative(Native Method)
04-26 14:54:35.359: W/System.err(11976):    at java.lang.reflect.Method.invoke(Method.java:507)
04-26 14:54:35.359: W/System.err(11976):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
04-26 14:54:35.359: W/System.err(11976):    at  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
04-26 14:54:35.359: W/System.err(11976):    at dalvik.system.NativeStart.main(Native Method)