java.net.ConnectException: Connection 127.0.0.1:8080 refused
16lz
2021-01-26
java.net.ConnectException: Connection 127.0.0.1:8080 refused 在使用android内置的模拟器访问本地机器上的资源时会报该错误
原因:模拟器把自己当成主机了,即,将127.0.0.1指向了自己
解决办法:android有个内置的ip:10.0.22,使用该ip来访问本地机器
既:
将原url:http://localhost:8080/androidLoadTest/web/test.txt
改为:http://10.0.2.2:8080/androidLoadTest/web/test.txt
原因:模拟器把自己当成主机了,即,将127.0.0.1指向了自己
解决办法:android有个内置的ip:10.0.22,使用该ip来访问本地机器
既:
将原url:http://localhost:8080/androidLoadTest/web/test.txt
改为:http://10.0.2.2:8080/androidLoadTest/web/test.txt
更多相关文章
- android中怎样将文件放入sdcard
- Android(安卓)Studio 设备模拟器(virtual devices)报错:“Intel HAX
- 模拟器上调试android launcher---android launcher移植之(三)
- abd找不到设备的解决方法
- FAQ_11_解决ADT的Logcat罢工问题
- adb命令基本操作
- Android基础之Android硬件
- Android(安卓)SDK目录结构和工具介绍
- ADB简介