question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pure python adb hangs at devices()

See original GitHub issue

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()

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
AmadoGuerrerocommented, Sep 9, 2021

@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.

2reactions
Swindcommented, Jul 4, 2020

Hi @superuser789

The adb server is running on your computer and the default port should be 5037.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

ADB Method freezes with python adb.devices() - Stack Overflow
its working fine . Now this is my code to connect to bluestack with my python app: from ppadb.client import Client adb =...
Read more >
pure-python-adb - PyPI
This is pure-python implementation of the ADB client. You can use it to communicate with adb server (not the adb daemon on the...
Read more >
Emulator release notes - Android Developers
Fixed a long-standing issue with the Windows emulator where sub-processes, such as ADB commands, failed to start if the username had spaces in...
Read more >
Frida Android Helper | Hamza's random blogposts
Enter Frida Android Helper. A command line tool written in Python and makes use of pure-python-adb to interface with the ADB server. For ......
Read more >
Native support for Android TV / Android devices - #459 by sweup
using Python ADB implementation with ... line 272, in async_update_ha_state await self.async_device_update() File ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found