当在Android上运行Netty gRPC服务器时,我得到了以下异常
java.lang.IllegalStateException: channel not registered to an event loop我使用的依赖项:
implementation 'io.grpc:grpc-kotlin-stub:1.2.0'
implementation 'io.grpc:grpc-netty-shaded:1.40.1'
implementation 'io.grpc:grpc-stub:1.40.1'
implementation 'io.grpc:grpc-protobuf-lite:1.40.1'
implementation 'io.grpc:grpc-okhttp:1.40.1'
implementation 'com.google.protobuf:protobuf-kotlin-lite:3.18.1'像这样初始化gRPC服务器:
NettyServerBuilder.forPort(7001)
.addService(Service())
.build()
.start()发布于 2021-12-02 19:05:51
事实证明,异常消息具有误导性,并且我的AndroidManifest文件中缺少网络权限:
<uses-permission android:name="android.permission.INTERNET" />https://stackoverflow.com/questions/70205157
复制相似问题