简体   繁体   中英

Can't connect to local server with android emulator

I am trying to develop a simple android login and registration application which will fetch data from local server(for now). I am using android studio and WAMP server. I have provided the internet permission in the manifest file. I have tried the urls:

  • 10.0.2.2
  • 127.0.0.1
  • 192.168.1.5(my IPv4 address)
  • 192.168.1.5:8080
  • localhost:80

Still evry time it shows

org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.1.5:8080 (or any of the above) refused

I have been trying this and followed every advice but the application stops unfortunately(as the emulator says).I have posted all my required java files and logcat in my previous question here: Unfortunately the application stopped working . It would be of great help if anyone guides me on this.

Use 10.0.2.2:8080 to connect to local server if server is running at port number 8080

Thanks

我遇到了同样的问题,直到我来到这里仅供参考:我不得不更改 Wampserver 上的端口(从端口 80 到端口 8080,因为端口 80 已经被使用(cmd、netstat -aon)。在我的 java 类中,我尝试了上面的地址,但只有 10.0.2.2:8080 对我有帮助。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM