Android 虚拟设备:从主机系统访问 NanoHTTPD [英] Android Virtual Device: Accessing NanoHTTPD from hostsystem
本文介绍了Android 虚拟设备:从主机系统访问 NanoHTTPD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Android 应用程序中使用了 NanoHTTPD.
I used NanoHTTPD for my android application.
在开发过程中,我在 AVD 上运行该应用程序.有没有办法从我的主机系统访问 Web 服务?AVD 的 IP 地址是什么?
During the development I am running the app on an AVD. Is there a way to accessing the web service from my host system? What´s the IP address of the AVD?
推荐答案
使用 adb 向前.
例如,如果您的 NanoHTTPD 在 AVD 上侦听端口 80,请运行
For example, if your NanoHTTPD listens to port 80 on AVD, run
adb forward tcp:20001 tcp:80
然后就可以连接到宿主机上的localhost:20001
来访问服务器了.
then you can connect to localhost:20001
on the host machine to access the server.
这篇关于Android 虚拟设备:从主机系统访问 NanoHTTPD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文