java.io.IOException Service not Available found while running my android program

Hybrid Developer picture Hybrid Developer · Mar 7, 2013 · Viewed 8.5k times · Source

when running my android project one of my class which is used for geo-coding is showing an io exception like service not available i couldn't find what is the error here please someone help me to fix this

My Class

String addressInput  = "Santa Clara";

geocoder = new Geocoder(Find_Tab_MainActivity.this);
    List<Address> address;

    address = geocoder.getFromLocationName(addressInput,5);
    if (address == null) {
        alert.showAlertDialog(Find_Tab_MainActivity.this, "Places Error",
                              "Sorry error occured.",
                              false);
    }
    else{
        Address location = address.get(0);
        latitude = location.getLatitude();
        longitude = location.getLongitude();

        System.out.println("radius:");
        nearPlaces = googlePlaces.Keywordsearch(latitude,longitude,radius+40000,"parking",type);

logcat

   03-07 12:55:09.752: D/Your Location(3625): latitude:37.422005, longitude: -122.084095
    03-07 12:55:09.812: W/System.err(3625): java.io.IOException: Service not Available
    03-07 12:55:09.862: W/System.err(3625):     at android.location.Geocoder.getFromLocationName(Geocoder.java:178)
    03-07 12:55:09.872: W/System.err(3625):     at com.kodspider.parkon.Find_Tab_MainActivity$LoadPlaces.doInBackground(Find_Tab_MainActivity.java:174)
    03-07 12:55:09.872: W/System.err(3625):     at com.kodspider.parkon.Find_Tab_MainActivity$LoadPlaces.doInBackground(Find_Tab_MainActivity.java:1)
    03-07 12:55:09.872: W/System.err(3625):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
    03-07 12:55:09.872: W/System.err(3625):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
    03-07 12:55:09.872: W/System.err(3625):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    03-07 12:55:09.872: W/System.err(3625):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
    03-07 12:55:09.872: W/System.err(3625):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
    03-07 12:55:09.872: W/System.err(3625):     at java.lang.Thread.run(Thread.java:1019)
    03-07 12:55:10.042: D/AndroidRuntime(3625): Shutting down VM
    03-07 12:55:10.042: W/dalvikvm(3625): threadid=1: thread exiting with uncaught exception (group=0x40015560)
    03-07 12:55:10.052: E/AndroidRuntime(3625): FATAL EXCEPTION: main
    03-07 12:55:10.052: E/AndroidRuntime(3625): java.lang.NullPointerException
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at com.kodspider.parkon.Find_Tab_MainActivity$LoadPlaces.onPostExecute(Find_Tab_MainActivity.java:208)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at com.kodspider.parkon.Find_Tab_MainActivity$LoadPlaces.onPostExecute(Find_Tab_MainActivity.java:1)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at android.os.AsyncTask.finish(AsyncTask.java:417)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at android.os.AsyncTask.access$300(AsyncTask.java:127)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at android.os.Handler.dispatchMessage(Handler.java:99)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at android.os.Looper.loop(Looper.java:130)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at android.app.ActivityThread.main(ActivityThread.java:3683)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at java.lang.reflect.Method.invokeNative(Native Method)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at java.lang.reflect.Method.invoke(Method.java:507)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    03-07 12:55:10.052: E/AndroidRuntime(3625):     at dalvik.system.NativeStart.main(Native Method)
    03-07 12:55:11.892: I/Process(3625): Sending signal. PID: 3625 SIG: 9

Answer

duggu picture duggu · May 15, 2013

Restart your device also (i had suffered Same problem) but this link save my time.

http://code.google.com/p/android/issues/detail?id=38009