I have a bluestacks emulator instance running at port 51510. As you can see in the image, I can connect to it from command line and call adb devices
command:
I have tested clicking etc, it is working. But when I try to do it with Python with below code, it hangs at adb.devices()
line.
from ppadb.client import Client
adb = Client(host='127.0.0.1', port=51510) #Stops on one of these two lines
devices = adb.devices()
How can I solve it?
CodePudding user response:
ppadb is a pure Python adb client so it does not make use of adb executable and is designed to directly communicate with adb server (note that adb server is not adbd on Android side!).
adb server is also the service that manages the list of connected devices (-> adb server is the service that answers adb devices
or adb.devices()
requests).
adb client <-> adb server <-> adbd on Android device 1
^
└---> adbd on Android device 2
By directly connecting to 127.0.0.1:51510 you even try to bypass the adb server which will not work as ppadb is designed to communicate with the adb server and not directly with the adbd on Android side. Therefore I would try to connect to adb server 127.0.0.1:5037 then it should work.