I'd like to connect to the Android emulator on Bluestacks 4 with ADB.
but I've got an error with adb.exe -s emulator-5554 shell
Checking devices.
$ adb.exe devices
List of devices attached
BH901... device
CB512... unauthorized
emulator-5554 device
Once I shutdown the Bluestacks window, the emulator-5554
will be hidden from the above command's result. thus I think emulator-5554
means bluestacks.
Then command as below to use adb.
$ adb.exe -s emulator-5554 shell
error: closed
But as you know, an error occurred.
First, in Bluestacks, go to Settings -> Preferences -> Enable Android Debug Bridge (ADB). Like this:
At this point, Bluestacks enables its adb functionality and exposes itself to the localhost at port 5555 (the default port)
So, in your command line, type adb connect localhost:5555
and you should be good to go.