pure python adb hangs at devices()
superuser789 opened this issue · comments
I have Python 3.7.3 64bit.
I have installed pure-python-adb-0.2.6.dev0.
Adb server is running on android-emulator.
I can connect successfully using adb.exe
But using following code :
from ppadb.client import Client
adb = Client(host='127.0.0.1', port=62001)
devices=adb.devices()
The Program seems to stuck at adb.devices()
The adb server is running on your computer and the default port should be 5037
.
Thanks
same issue here
Same issue here:
- I have a NOX app player running a device.
If I go to iterm and I write: adb connect 127.0.0.1:62001
it says connected -> I can send ADB commands to the emulator.
But now have it in a python code it hangs when adb.devices() is invoked. With a debugger, it says "Collecting Data" but nothing else
had the same issue, but @Swind's comment helped!
@superuser789 I know this is late, but for anyone else also trying to use the Nox emulator and ADB together, here's what I did.
The reason it hangs is because ppadb does a version check when initializing and if the versions don't match, it will close the connection.
So the key here is to first of all make sure the Nox version of adb server is running (not any new ones that you have on disk).
You can make sure the right version is running by going to {NOX_INSTALL_DIR}/bin
and running ./nox_adb kill-server
and then ./nox_adb start-server
You may also need to connect adb if it doesn't do it automatically. So while still in this folder, run ./adb connect 127.0.0.1:62001
.
It should connect to the server and run ./adb devices
and make sure you see a device there.
Okay, now you have Nox's version running. The next step is to go into the directory where you've installed ppadb, and open up ppadb/command/host/__init__.py
and find the version
function.
Next, comment out the line that says version = conn.receive()
and replace it with version = "24"
(as of right now Nox is using adb version 36 (24 is 36 in HEX). Save that, and everything should work as normal.
Its a quick, ugly, and dirty hack but it worked for me.