连接的设备是设备或模拟器

Connected device is a device or an emulator

我有一个连接到我的电脑的设备。是否有可能知道这个设备是真实的 phone 还是使用 adb 的模拟器?如果可能的话,我该怎么做? Google 和 documentation 没有解决我的问题。

您可以对 adb 使用 -d-e 选项。

例如,在脚本中,您可以使用 adb -d shell true,这将 return error: no devices found 和非零退出状态,如果您有模拟器 运行 而不是连接的设备,或者如果连接了设备则为零退出状态。

同样,您可以使用 adb -e shell true

您可以使用adb get-serialno获取设备的序列号。在模拟器上,序列号以 emulator-.

开头