Guide: Start an android emulator on your remote system

I have a light(cheap) windows laptop, I can develop on it if I run the compilation and the emulator on my desktop endeavourOS pc. Vs code’s remote extension starts everything on the remote, you just can’t see the emulator on your local machine. This is how you can run and view the emulator on the local machine:

You can launch a headless android emulator with this command, it works without needing to be logged into desktop on the remote or if you use wayland.

emulator $name_of_avd -no-window

If you are logged into an X session, this way it renders on the gpu and it’s a little bit faster, not by a lot though.

DISPLAY=:0 emulator $name_of_avd -gpu host -no-window

Then forward the adb port onto the network with:

adb forward tcp:1234 tcp:5555
adb tcpip 5555
ssh -Nfg -L 1234:localhost:5555 localhost

Add the 1234 tcp port to your firewall.

On your local machine, connect to the emulator’s adb instance:

adb connect <LAN IP>:1234

Then use scrcpy or Android Studio’s built-in screen mirroring to access the device’s screen.

You can also connect your physical android device to the remote with something like tailscale+wireless debugging. But I need the emulator to try my app on multiple android versions.

1 Like