java.io.IOException:grpc失败 [英] java.io.IOException: grpc failed

查看:2584
本文介绍了java.io.IOException:grpc失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



运行的代码

  @Override 
public void onMapReady(GoogleMap googleMap){
mMap = googleMap;
尝试{
Geocoder geocoder = new Geocoder(getApplicationContext(),Locale.getDefault());
列表<地址> listAdresses = geocoder.getFromLocationName(London,10);
Log.i(PlaceInfo,listAdresses.get(0).toString());
} catch(IOException e){
e.printStackTrace();


控制台输出错误:

  07-10 12:01:38.781 13712-13712 / co.siqve.maplocationdemo W / System.err:java.io.IOException:grpc失败
07-10 12:01:38.781 13712-13712 / co.siqve.maplocationdemo W / System.err:位于android.location.Geocoder.getFromLocationName(Geocoder.java:178)
07-10 12: 01:38.781 13712-13712 / co.siqve.maplocationdemo W / System.err:at co.siqve.maplocationdemo.MapsActivity.onMapReady(MapsActivity.java:70)
07-10 12:01:38.781 13712-13712 /co.siqve.maplocationdemo W / System.err:at com.google.android.gms.maps.zzaj.zza(Unknown Source)
07-10 12:01:38.781 13712-13712 / co.siqve。 maplocationdemo W / System.err:com.google.android.gms.maps.internal.zzaq.onTransact(Unknown Source)
07-10 12:01:38.781 13712-13712 / co.siqve.maplocationdemo W / System.err:在android.os.Binder.transact(Binder.java:499)
07-10 12:01:38.781 13712-13712 / co.siqve.maplocationdemo W / System.err:在com.google.android.gms.maps.internal.aq.a(:com.google.android.gms.DynamiteModulesB:5)
07-10 12:01:38.781 13712-13712 / co.siqve。 maplocationdemo W / System.err:com.google.maps.api.android.lib6.impl.bb.run(:com.google.android.gms.DynamiteModulesB:5)
07-10 12:01: 38.781 13712-13712 / co.siqve.maplocationdemo W / System.err:at android.os.Handler.handleCallback(Handler.java:751)
07-10 12:01:38.781 13712-13712 / co.siqve .maplocationdemo W / System.err:at android.os.Handler.dispatchMessage(Handler.java:95)
07-10 12:01:38.781 13712-13712 / co.siqve.maplocationdemo W / System.err:在android.os.Looper.loop(Looper.java:154)
07-10 12:01:38.781 13712-13712 / co.siqve.maplocationdemo W / System.err:at android.app.ActivityThread.main (ActivityThread.java:6119)
07-10 12:01:38.782 13712-13712 / co.siqve.maplocationdemo W / System.err:在java.lang.reflect.Method.invoke(Native方法)
07-10 12:01:38.782 13712-13712 / co.siqve.maplocationdemo W / System.err:at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:886)
07-10 12:01:38.782 13712-13712 / co.siqve.maplocationdemo W / System.err:at com。 Android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Android SDK版本(API等级):25



Android Studio插件是最新的。



非常感谢!



编辑:

现在问题似乎已解决,这里是我的解决方案

解决方案

UPDATE :



现在问题似乎已解决。我不确定是否问题出在我身上,所以如果你在这篇文章之前有这个问题,请重新运行你的应用程序,看看它现在是否有效。



如果它仍然不起作用,这是我自己做的可能使它工作的东西:


  1. I卸载并删除与Android Studio相关的所有文件。 (不是项目文件)。

  2. 然后重新安装Android Studio,然后重新打开项目。运行应用程序(我使用的是Android Studio内置的仿真器)我使用了不同的虚拟设备和设备API。这次我在Pixel上运行它,使用API​​ 23和x86_64。


When I use call getFromLocationName I get an IOException with description "grpc failed".

Code that's ran

@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    try {
        Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
        List<Address> listAdresses = geocoder.getFromLocationName("London", 10);
        Log.i("PlaceInfo", listAdresses.get(0).toString());
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Error the console outputs:

07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err: java.io.IOException: grpc failed
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at android.location.Geocoder.getFromLocationName(Geocoder.java:178)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at co.siqve.maplocationdemo.MapsActivity.onMapReady(MapsActivity.java:70)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at com.google.android.gms.maps.zzaj.zza(Unknown Source)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at com.google.android.gms.maps.internal.zzaq.onTransact(Unknown Source)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at android.os.Binder.transact(Binder.java:499)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at com.google.android.gms.maps.internal.aq.a(:com.google.android.gms.DynamiteModulesB:5)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at com.google.maps.api.android.lib6.impl.bb.run(:com.google.android.gms.DynamiteModulesB:5)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at android.os.Handler.handleCallback(Handler.java:751)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at android.os.Looper.loop(Looper.java:154)
07-10 12:01:38.781 13712-13712/co.siqve.maplocationdemo W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6119)
07-10 12:01:38.782 13712-13712/co.siqve.maplocationdemo W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
07-10 12:01:38.782 13712-13712/co.siqve.maplocationdemo W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
07-10 12:01:38.782 13712-13712/co.siqve.maplocationdemo W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Android SDK Version (API Level): 25

Android Studio plugins are up to date.

Thanks in advance!

EDIT:

Problem seems to be fixed now, here is my solution.

解决方案

UPDATE:

The problem seems to be solved now. I'm not sure if it the problem ever was on my end, so if you had this problem prior to this post, re-run your app and see if it works now.

If it still doesn't work, here is the stuff I did myself that "might" have made it work:

  1. I uninstalled and deleted all files related to Android Studio. (NOT the project files).
  2. I then reinstalled Android Studio, and reopened the project back up.
  3. When running the app (I'm using Android Studio's built in emulator) I used a different virtual device and device API. This time I ran it on Pixel, with API 23, x86_64.

这篇关于java.io.IOException:grpc失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆