pure-python-adb icon indicating copy to clipboard operation
pure-python-adb copied to clipboard

Cannot connect to the device even if using command line I can

Open jenniejj opened this issue 4 years ago • 2 comments

While using this:

from ppadb.client import Client as AdbClient
# Default is "127.0.0.1" and 5037
client = AdbClient(host="192.168.1.10", port=5555)
device = client.device("myphonename")
device.shell("echo hello world !")

I can never get it connected, it just hangs.

If I try to do the same and connect by following adb kill-server adb USB adb tcpip 5555 unplug/plug USB cable connect 192.168.1.10:5555

I get Connected to 192.168.1.10:5555

and I can also see it connected by using adb devices

What is wrong and how can I debug this?

jenniejj avatar Feb 19 '21 21:02 jenniejj

I have the problem too. ADB in comandline work well. But I cannot connect in python. Windows + Bluestacks

awas-01 avatar Mar 08 '21 12:03 awas-01

@jenniejj

If you have connected your device via USB, do this:

from ppadb.client import Client as AdbClient #Default is "127.0.0.1" and 5037 client = AdbClient(host="127.0.0.1", port=5037) # or just do client = AdbClient() if you want to leave default as is. device = client.device("<your-device-dsn>") device.shell("echo hello world !")

If you have connected wireless: from ppadb.client import Client as AdbClient #Default is "127.0.0.1" and 5037 client = AdbClient(host="127.0.0.1", port=5037) #or just do client = AdbClient() if you want to leave default as is. device = client.device("<your-ip-address>") # 192.168.1.10:5555 device.shell("echo hello world !")

hasanibnmansoor avatar Apr 29 '21 09:04 hasanibnmansoor