1

I am working with Maps and Location,the following code is right but then also it shows grpc failed

Geocoder gc=new Geocoder(this);
        List<Address> list=gc.getFromLocationName("White House",1);
        Address adr=list.get(0);

How can i resolve it? i am using android studio 2.3.3.

Akib Bagwan
  • 138
  • 1
  • 2
  • 14
  • [use it](https://stackoverflow.com/questions/7553657/class-loader-exception-while-working-with-maps-in-android) – Akib Bagwan Jul 29 '17 at 03:16
  • What was the solution? I get the same error. I'm not using maps, just Geocoder. I tried adding to the manifest just in case, but didn't solve anything. – Mackan Aug 03 '17 at 22:12
  • Anybody knows the answer??? i started getting this just today, its been working all along and suddenly it stopped working just now and throwing exception – Paul Man Aug 16 '17 at 15:45
  • 1
    Possible duplicate of [java.io.IOException: grpc failed](https://stackoverflow.com/questions/45012289/java-io-ioexception-grpc-failed) – Simon Rolin Aug 29 '17 at 12:52
  • Anybody knows any solution, I also started to get this error. Frustrating thing is that, It works on some real device but on some not. And have tried almost all possible solutions, but no result. – zephyr Oct 24 '17 at 12:22

5 Answers5

1

This issue has been addressed in https://stackoverflow.com/a/46256093/20394

Solution is to upgrade Google Play services to revision 44+

Mike Samuel
  • 118,113
  • 30
  • 216
  • 245
Wysel
  • 11
  • 1
1

I got the same error, I was in a Fragment and my solution was creating the Geocoder sending new Geocoder(getActivity().getApplicationContext()); instead new Geocoder(getContext());

I hope it help you

AWolfsdorf
  • 39
  • 6
0

I solved this issue by reducing the work in main thread. I tried to restart the emulator and reinstall android studio but nothing works.Then, I noticed some messages in logcat

"Skipped 305 frames! The application may be doing too much work on its main thread."

I thought my app was having a heavy work so I moved all google map's location method to background thread and now it works like a charm. Hope it helps.

0

I used to get same error. I solved it by creating the Geocoder in the following way:

Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
Daniel Puiu
  • 962
  • 6
  • 21
  • 29
Swarna
  • 186
  • 1
  • 5
0

I solved a similar issue by adding

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>

to my manifest file.

Turning wifi off and on at the start of the application was solving the error but this made it so I didnt have to do that every time.