GRPCPROTOCOL_ERROR invalid settings id: -509报错

毕业放假回公司,我的电脑打开就蓝屏了,后来就直接换了电脑,从Git上pull代码后一直连不上服务器,我一直以为我的代码没有动就一定是服务器端出现问题了,折腾了好几天才最后解决,因为Grpc用的人也少百度也搜不到这种问题,这件事告诉我开发中千万不要换电脑乱升级软件什么的,不然会要命的,我android端Grpc一直用的是1.0版本的,就理所当然的以为用1.0当然没事了,谁知道就是版本的问题,换成1.4果然就好了,以下Android Grpc最新的。
关于Android Grpc的学习,我推荐一下这篇文章,写的非常细,不过他用的是1.0的GRPC,我做过测试已经连不上服务器了,最好用1.4的试试。

GRPC Android SSL/TLS Demo(Android上带有SSL/TLS加密的gRPC使用详解)
http://www.jianshu.com/p/2873a8349ca0

compile 'io.grpc:grpc-okhttp:1.4.0'
compile 'io.grpc:grpc-protobuf-lite:1.4.0'
compile 'io.grpc:grpc-stub:1.4.0'
07-05 11:42:58.540 19393-19393/lbs.mr.com.test2 E/AndroidRuntime: FATAL EXCEPTION: main
                                                                  Process: lbs.mr.com.test2, PID: 19393
                                                                  java.lang.RuntimeException: Unable to start activity ComponentInfo{lbs.mr.com.test2/lbs.mr.com.test2.Main2Activity}: io.grpc.StatusRuntimeException: UNAVAILABLE
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
                                                                      at android.app.ActivityThread.access$800(ActivityThread.java:143)
                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                      at android.os.Looper.loop(Looper.java:136)
                                                                      at android.app.ActivityThread.main(ActivityThread.java:5120)
                                                                      at java.lang.reflect.Method.invokeNative(Native Method)
                                                                      at java.lang.reflect.Method.invoke(Method.java:515)
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818)
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
                                                                      at dalvik.system.NativeStart.main(Native Method)
                                                                   Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE
                                                                      at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:230)
                                                                      at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:211)
                                                                      at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:144)
                                                                      at lbs.passport.PassportServiceGrpc$PassportServiceBlockingStub.register(PassportServiceGrpc.java:235)
                                                                      at lbs.mr.com.test2.Main2Activity.onCreate(Main2Activity.java:29)
                                                                      at android.app.Activity.performCreate(Activity.java:5351)
                                                                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257) 
                                                                      at android.app.ActivityThread.access$800(ActivityThread.java:143) 
                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209) 
                                                                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                      at android.os.Looper.loop(Looper.java:136) 
                                                                      at android.app.ActivityThread.main(ActivityThread.java:5120) 
                                                                      at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                      at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:818) 
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) 
                                                                      at dalvik.system.NativeStart.main(Native Method) 
                                                                   Caused by: java.io.IOException: PROTOCOL_ERROR invalid settings id: -509
                                                                      at io.grpc.okhttp.internal.framed.Http2.ioException(Http2.java:589)
                                                                      at io.grpc.okhttp.internal.framed.Http2.access$200(Http2.java:47)
                                                                      at io.grpc.okhttp.internal.framed.Http2$Reader.readSettings(Http2.java:304)
                                                                      at io.grpc.okhttp.internal.framed.Http2$Reader.nextFrame(Http2.java:162)
                                                                      at io.grpc.okhttp.OkHttpClientTransport$ClientFrameHandler.run(OkHttpClientTransport.java:739)
                                                                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                      at java.lang.Thread.run(Thread.java:841)

你可能感兴趣的:(GRPCPROTOCOL_ERROR invalid settings id: -509报错)