本地有个php环境,在本地浏览器可以访问本机的这个地址:http://127.0.0.1/test/listviewtest/news.php
。
可是android模拟器不能访问,报这个错误:
java.net.ConnectException: failed to connect to /127.0.0.1 (port 80) after 2500ms: isConnected failed: ECONNREFUSED (Connection refused)
网上说的把127.0.0.1改成10.0.2.2,没有成功。
You first use the browser in the simulator to access the following
http://127.0.0.1/test/listviewtest/news.php
Change 127.0.0.1 to the IP of your computer in the LAN
How to get it: Open cmd, enter ipconfig to get your IP
1. Use your real IP instead
2. Use your real machine (connected to wifi) and access the address with your browser