简体   繁体   中英

How to access the wamp localhost in android device for testing?

在模拟器中,我使用这个 10.0.2.2 ip 地址来测试它工作正常的应用程序,但它不适用于在 android 设备中进行测试。我通过 USB 电缆连接设备。如何使用本地主机在设备中测试应用程序。谁能知道帮我。

USB won't provide network to you.

Hope this will help you.

How can I access my localhost from my Android device?

使用 WIFI 这是您问题的最佳解决方案......并使用您的 IP 地址进行连接......从 android 设备到本地服务器..:-)

使用 Connectify 软件,并在您的 android 代码中插入系统的 IP 地址,而不是 10.0.0.2。

  1. Start Wamp server on pc
  2. Click Wamp windows taskbar
  3. Click "Put Online" (bottom of wamp)
  4. Run command prompt
  5. type ipconfig and enter
  6. Note your IPv4 address (192.168.1.206 in my case)
  7. Make sure your pc and android connect with same wifi
  8. Make sure your wifi network as "Home Network"
  9. Open browser on android
  10. Type your IPv4 address

I hope this help.

For Windows 10 Users

  1. go to Control Panel-> System and Security->Windows Defender Firewall->Turn Windows Defender Firewall on or off.

Set both private and public network settings to off.

  1. open a command prompt. type ipconfig and note your IP.

  2. on your android device open a browser and type in your pc's IP.

I used this with WIFI and it worked fine.

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