10.0.2.2:8080 in web browser in emulator is not working

北城余情 提交于 2019-12-23 10:09:19

问题


I have a wamp server in localhost. I tried to make http request from my android app. But cannot get it right. Many said 10.0.2.2:8080 will point to localhost from emulator. So i tried to open it in web browser from emulator. i typed in url as "10.0.2.2/cifi/test.php". But emulator popped error as "net:CONNECTION_TIMED_OUT"

Need explanation: how to make my wamp server in local machine to listen 10.0.0.2:8080 from emulator's browser.


回答1:


Your Wamp Server seems to be accepting only localhost connections.

Left click on wamp icon -> put online

Additionnally you should type a url http://10.0.2.2:8080/cifi/test.php instead of http://1.0.2.2/cifi/test.php




回答2:


It finally worked! I used "10.0.2.2:80/cifi/test.php". My wamp server listens only to that port. Thanks to everyone who wanted to help me!




回答3:


Weirdly enough, in my case, I had to turn on and off the airplane mode to get it working.



来源:https://stackoverflow.com/questions/21510311/10-0-2-28080-in-web-browser-in-emulator-is-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!