android-emulator-container-scripts
android-emulator-container-scripts copied to clipboard
Adb reverse commands not working
Setting up reverse proxy on an android emulator running inside docker is not working. I keep getting
error: more than one device/emulator error .
I am using run.sh to start the container. Here is the command I use to setup reverse proxy
$ adb devices
List of devices attached
localhost:5555 device
$ adb reverse tcp:50051 tcp:50051
error: more than one device/emulator
$ adb -s localhost:5555 reverse tcp:50051 tcp:50051
error: more than one device/emulator
I'm seeing this on Android 8 and earlier, but not on 9 & 10.
May be related to https://github.com/Genymobile/scrcpy/issues/5#issuecomment-381316950 and https://android-review.googlesource.com/c/platform/system/core/+/664644
https://issuetracker.google.com/issues/37066218 (via https://www.genymotion.com/blog/open-source-project-scrcpy-now-works-wirelessly/) pretty much confirms it; there's a bug in adbd (running on the device side) which will cause adb reverse to fail if the device is connected over TCP (e.g. adb connect/what you do with the emulator).
This is fixed in Android P.