简体   繁体   English

如何访问android设备中的wamp localhost进行测试?

[英]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. USB 不会为您提供网络。

Hope this will help you.希望这会帮助你。

How can I access my localhost from my Android device? 如何从我的 Android 设备访问我的本地主机?

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

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

  1. Start Wamp server on pc在 PC 上启动 Wamp 服务器
  2. Click Wamp windows taskbar单击 Wamp windows 任务栏
  3. Click "Put Online" (bottom of wamp)单击“在线”(wamp 底部)
  4. Run command prompt运行命令提示符
  5. type ipconfig and enter输入 ipconfig 并输入
  6. Note your IPv4 address (192.168.1.206 in my case)请注意您的 IPv4 地址(在我的情况下为 192.168.1.206)
  7. Make sure your pc and android connect with same wifi确保您的 PC 和 android 使用相同的 wifi 连接
  8. Make sure your wifi network as "Home Network"确保您的 wifi 网络为“家庭网络”
  9. Open browser on android在安卓上打开浏览器
  10. Type your IPv4 address输入您的 IPv4 地址

I hope this help.我希望这会有所帮助。

For Windows 10 Users对于 Windows 10 用户

  1. go to Control Panel-> System and Security->Windows Defender Firewall->Turn Windows Defender Firewall on or off.转到“控制面板”->“系统和安全”->“Windows Defender 防火墙”->“打开或关闭 Windows Defender 防火墙”。

Set both private and public network settings to off.将专用和公共网络设置都设置为关闭。

  1. open a command prompt.打开命令提示符。 type ipconfig and note your IP.输入 ipconfig 并记下您的 IP。

  2. on your android device open a browser and type in your pc's IP.在您的安卓设备上打开浏览器并输入您电脑的 IP。

I used this with WIFI and it worked fine.我将它与 WIFI 一起使用,效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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