1、android前端报错如下
代码,没有指定端口
private String http = "http://172.20.10.4/news/"
2、接口访问时候,报错信息
java.net.ConnectException: Failed to connect to /172.20.10.4:80
分析如下:我们都知道后台默认端口是8080,那android显示端口是80,那肯定异常。有可能自动分配不了8080端口。
这个时候需要android端ip地址加上指定端口8080
3、修改代码如下
private String http = "http://192.168.3.6:8080/news/";
运行成功。