pythonadbbluestacks

Able to connect ADB to bluestacks, but not ppadb to bluestacks


I have been trying to use ppadb (android debug bridge with python) together with bluestacks. I was able to connect adb to the emulator but was not able to connect it with the python lib. It doesn't "not find" the emulator, it just stops and keeps searching and never goes beyond the line that searches for devices.


import ppadb
from ppadb.client import Client
from PIL import Image
import numpy
import time

adb = Client(host='127.0.0.1', port=5555) #Stops on one of these two lines 
devices = adb.devices()

if len(devices) == 0:
    print("No device found")
    quit()

device = devices[0]


Solution

  • BlueStacks uses port 5037 for ADB. This means that

    adb = Client(host='127.0.0.1', port=5555)
    

    should instead be

    adb = Client(host='127.0.0.1', port=5037)