无法在ADB、Android模拟器中连接到本地主机

问题描述 投票:0回答:1

我正在使用 LDplayer4(作为 Android 模拟器),并且我正在用 python 制作一个简单的游戏宏 所以我使用 pure-python-adb 模块在 python 中控制它。

在我将文件移动到另一台电脑之前它可以工作,但在新电脑上它不起作用。

这些是我的问题:

  • 下面这个问题有什么办法解决吗?
  • 如果没有,如何在不使用远程连接的情况下连接20个以上的模拟器?

这是我的脚本中发生错误的部分。

client = [type(0)] * emulatorcnt
adbdevice = [type(0)] * emulatorcnt
    for i in range(emulatorcnt):
        client[i] = AdbClient(host="127.0.0.1", port=5037)
        client[i].remote_connect("localhost", ports[emulatorcnt]*2+5555))
        adbdevice[i] = client[i].device("localhost:" + str(ports[emulatorcnt]*2+5555))
  • emulatorcnt 是一个整数,表示我想同时运行的模拟器数量
  • ports[]是一个整数,表示LDplayer中的端口号

例如, this instance works in port no. 5557

由于我使用 pandas 来存储端口号,因此我更改了示例代码以使其更容易理解。因此,您可能会在示例中看到错误,但这应该不是问题,因为它在其他 PC 上工作正常。

错误发生是这样的 Error message

我想找出问题所在,所以我把代码改成了这样

client = AdbClient(host="127.0.0.1", port=5037)
adbdevice = client.devices())

...它工作正常,所以remote_connect似乎是问题所在。 但问题没有解决,因为我要连接20多个模拟器。

python windows adb emulation
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.