转http://h3clikejava.blog.163.com/blog/static/134473029201111002645197/
Android模拟器获取IP的方法及多模拟器使用adb shell
开启多模拟器时使用adb shell无法进入android,会报error: more than one device and emulator错误。这个时候使用:adb devices查看加载的设备,比如返回结果为
List of devices attached
emulator-5554 device
emulator-5556 device
在使用 adb -s [设备] [命令]执行命令,比如:
adb -s emulator-5554 shell
进入shell后使用getprop命令获取系统信息
其中的
[net.gprs.local-ip]: [10.0.2.15]
即为模拟器的ip地址
这里值得注意的是,多个模拟器ip地址都是相同的。
本文介绍如何在Android模拟器中获取IP地址,并解决了在使用多个模拟器时遇到的ADB命令错误问题。通过指定特定模拟器的设备ID,可以避免混淆并准确地执行ADB shell命令。
773

被折叠的 条评论
为什么被折叠?



