简体   繁体   English

是否可以将LAN连接到Android模拟器

[英]Is it possible to connect LAN to Android emulator

I want to connect Ethernet to android device and check it's properties. 我想将以太网连接到android设备并检查其属性。 For example NetworkInterface networkInterface = NetworkInterface.getByName("eth0"); 例如NetworkInterface networkInterface = NetworkInterface.getByName("eth0"); But currently I don't have Ethernet to USB connector. 但是目前我没有以太网到USB连接器。 Is it possible to check with android emulator? 是否可以使用Android模拟器进行检查? Is it possible to connect emulator by Ethernet? 可以通过以太网连接仿真器吗? I tried something. 我试过了 But In emulator I can use WiFi or Mobile data only. 但是在模拟器中,我只能使用WiFi或移动数据。 Please let me know how to connect via Ethernet. 请让我知道如何通过以太网连接。

Ciao, 再见,

as said in the Android documentation : Android文档中所述:

"Each instance of the emulator runs behind a virtual router/firewall service that isolates it from your development machine network interfaces and settings and from the internet. An emulated device can't see your development machine or other emulator instances on the network. Instead, it sees only that it is connected through Ethernet to a router/firewall . [...] All addresses managed by the router are in the form of 10.0.2.xx, where xx is a number. Addresses within this space are pre-allocated by the emulator/router as follows:" “仿真器的每个实例都在虚拟路由器/防火墙服务后面运行,该服务将其与开发机器的网络接口和设置以及互联网隔离。仿真的设备看不到网络上的开发机器或其他仿真器实例。相反, 它只能看到它通过以太网到一个路由器/防火墙连接 。[...]由路由器管理的所有地址都在10.0.2.xx,其中xx是数字的形式。该空间中的地址被预先由仿真器/路由器分配如下:“

Android模拟器网络地址

Hope this helps and have a good day, 希望这会有所帮助,并祝您有美好的一天,
Antonino 安东尼

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

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