Android/Kotlin 教程的 gRPC 快速入门 - 服务器响应不可用
gRPC Quick start for Android/Kotlin tutorial - UNAVAILABLE in Server response
在 gRPC Quick start for Android/Kotlin 之后,我成功地在我的 PC 上构建并 运行 服务器并安装了 Android 应用程序(在本地网络中通过 TCP 与 adb 连接,相同子网,PC 防火墙已关闭)。
但是当 运行打开应用程序时,输入例如“爱丽丝”并点击 SEND GRPC REQUEST
,我在 Server response
中得到 UNAVAILABLE
。服务器为运行ning,监听50051端口
我有一个功能齐全的连接:当 运行例如python3 -m http.server
在我的 PC 上,我可以毫无问题地从我的 android 设备访问它。
我觉得奇怪的一件事是,该教程中没有任何地方提到在客户端指定服务器的 IP 地址 code/application。
我错过了什么?
为了指定服务器的IP地址,我们需要加上-PserverUrl=http://xxx.xxx.xxx.xxx:50051
:
.\gradlew :android:installDebug -PserverUrl=http://xxx.xxx.xxx.xxx:50051
在 gRPC Quick start for Android/Kotlin 之后,我成功地在我的 PC 上构建并 运行 服务器并安装了 Android 应用程序(在本地网络中通过 TCP 与 adb 连接,相同子网,PC 防火墙已关闭)。
但是当 运行打开应用程序时,输入例如“爱丽丝”并点击 SEND GRPC REQUEST
,我在 Server response
中得到 UNAVAILABLE
。服务器为运行ning,监听50051端口
我有一个功能齐全的连接:当 运行例如python3 -m http.server
在我的 PC 上,我可以毫无问题地从我的 android 设备访问它。
我觉得奇怪的一件事是,该教程中没有任何地方提到在客户端指定服务器的 IP 地址 code/application。
我错过了什么?
为了指定服务器的IP地址,我们需要加上-PserverUrl=http://xxx.xxx.xxx.xxx:50051
:
.\gradlew :android:installDebug -PserverUrl=http://xxx.xxx.xxx.xxx:50051