首先要保证url填写的是PC的IP地址
可以在左下角输入cmd打开命令提示符
然后输入ipconfig 查看自己的ipv4地址![](https://i-blog.csdnimg.cn/blog_migrate/43d58a6f52986795588e59f20030a47c.png)
在Android中访问的url设置为http://192.168.1.102:8081/即可
val retrofit = Retrofit.Builder()
.baseUrl("http://192.168.1.102:8081/")
.addConverterFactory(GsonConverterFactory.create())
.build()