在模拟器中,我使用这个 10.0.2.2 ip 地址来测试它工作正常的应用程序,但它不适用于在 android 设备中进行测试。我通过 USB 电缆连接设备。如何使用本地主机在设备中测试应用程序。谁能知道帮我。
USB won't provide network to you.
Hope this will help you.
使用 WIFI 这是您问题的最佳解决方案......并使用您的 IP 地址进行连接......从 android 设备到本地服务器..:-)
使用 Connectify 软件,并在您的 android 代码中插入系统的 IP 地址,而不是 10.0.0.2。
I hope this help.
For Windows 10 Users
- 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.
open a command prompt. type ipconfig and note your IP.
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.