1

I need to forward a port on an android emulator, right now I had to type the command every time:

adb forward tcp:23946 tcp:23946

Is there any way to make this automatic? I tried to replace adb with a script but that command won't work until the device is up and running.

Any ideas?

daisy
  • 22,498
  • 29
  • 129
  • 265

1 Answers1

1

Based on this answer (which I've tested and works, though it wasn't for a scenario like this one), you could simply write a script that waits until the emulator is booted.

Something like (pseudocode, don't know which platform you're on) :)

emulator @emulator-name
while ('adb shell getprop init.svc.bootanim' == "running") sleep(10s)
adb forward tcp:23946 tcp:23946
Community
  • 1
  • 1
matiash
  • 54,791
  • 16
  • 125
  • 154