When I use call getFromLocationName I get an IOException with description \"grpc failed\".
Code that\'s ran
@Override
public void onMapReady(GoogleMa
Today (2017-09-16) my Android Studio (2.3.3) got an update for Google Play services to revision 44. The issue was fixed afterwards. No code or setup changes from my side.
I experienced the same issue and didn't know where the problem was. At all... Until recently, I started noticing that this problem appeared on a real device, when I had configured a proxy. When I used charles on MAC there was no issue with that, but when I started using MITM on Linux, this issue starting popping every time, without exception. Probably need to configure MITM additionally. But the bottom line is, if you turn off your proxy, you should be fine.
So look into that maybe.
I face this issue on Android 4.4.2 device several times. For me the solution is simply to restart the handset. No code update no Android studio uninstall.
I faced this issue while getting Addresses List using geocoder.getFromLocation() method, the problem is that getting addresses list from latitude,longitude takes time or on some slow devices it takes more time and, also sometimes it give me the java-io-ioexception-grpc-failed.
I fix this problem using Rx Java.
public class AsyncGeocoder {
private final Geocoder geocoder;
public AsyncGeocoder(Context context) {
geocoder = new Geocoder(context);
}
public Disposable reverseGeocode(double lat, double lng, Callback callback) {
return Observable.fromCallable(() -> {
try {
return geocoder.getFromLocation(lat, lng, 1);
} catch (Exception e) {
AppLogger.d("throwable,", new Gson().toJson(e));
e.printStackTrace();
}
return false;
}).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> {
//Use result for something
AppLogger.d("throwable,", new Gson().toJson(result));
callback.success((Address) ((ArrayList) result).get(0));
}, throwable -> AppLogger.d("throwable,", new Gson().toJson(throwable)));
}
public interface Callback {
void success(Address address);
void failure(Throwable e);
}
}
Calling Position
mViewModel.getLocation(asyncGeocoder, getLat(), getLng(), this);
ViewModel Method
public void getLocation(AsyncGeocoder geocoder, Double lat, Double lng, AsyncGeocoder.Callback callback) {
getCompositeDisposable().add(geocoder.reverseGeocode(lat, lng, callback));
}
AOA! turn the accuracy Mode of device Gps to (only gps) instant of other option and then try......
worked for mesettings are like this , i am postie you can also find them on emulators
I can reproduce this issue (java.io.IOException: grpc failed), when there is no Internet connection on my real device.