Swind / pure-python-adb

This is pure-python implementation of the ADB client.
MIT License
553 stars 104 forks source link

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

Open jenniejj opened 3 years ago

jenniejj commented 3 years ago

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?

awas-01 commented 3 years ago

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

hasanibnmansoor commented 3 years ago

@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("") 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("") # 192.168.1.10:5555 device.shell("echo hello world !")`