When I use call getFromLocationName I get an IOException with description \"grpc failed\".
Code that\'s ran
@Override
public void onMapReady(GoogleMa
This issue appeared for me (even though I make the request on a background thread), but in the Android Studio emulator only. A strange workaround that fixes it for me is to turn on and then turn off airplane mode!
I finally got this to work by using the following configuration for version 25 SDK, Build Tools and API emulator.
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example..."
minSdkVersion 15
targetSdkVersion 25
Also using Google API version 11.0.2.
May be you are having this issue in genymotion and android studio emulator only. I faced same issue with genymotion and android studio emulator and then i checked it in android real device. It's working good for me. Did you check it in real device?
This was happening also on my Samsung S7 Edge phone with Oreo installed.
It only happened when I had an airplane mode on (not always - means something might have been cached at some points). I didn't explore the guts of Geocoder but I assume it requires some sort connectivity to get the information (that would also explain why this is happening so often on emulators).
For me the solution was to check the network connectivity status and call this only when status != NETWORK_STATUS_NOT_CONNECTED
.
For this you can implement a broadcast receiver, that will listen to any status changes on network.
Register receiver
IntentFilter networkFilter = new IntentFilter();
networkFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
getActivity().registerReceiver(NetworkChangeReceiver, networkFilter);
Setup broadcast receiver to handle the broadcast
private BroadcastReceiver NetworkChangeReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {
int status = NetworkUtil.getConnectivityStatusString(context);
if (status == NetworkUtil.NETWORK_STATUS_NOT_CONNECTED) {
} else {
// do your stuff with geocoder here
}
}
};
I seem to have fixed this issue by opening the top toolbar of the phone and just swithing between wifi and network, i guess the operating memory on all virtual devices is set to 2GB RAM and finding location is just using too much therefore, I saw a skip in frames and location not being able to search. So if it is dropping this error, just switch from Wifi to Network and backwards.
after some research figure out how to solve this , in my case all ways like put code in new Thread
or use GeocodingApi
not work , i just make sure
play-services-base
and
play-services-location
have same version like below :
implementation 'com.google.android.gms:play-services-base:17.1.0'
implementation 'com.google.android.gms:play-services-location:17.1.0'