└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Running an ARM Emulator in Azure 2 | 3 | ## Docker Install 4 | Follow the Docker docs to install on Ubuntu: https://docs.docker.com/engine/install/ubuntu/ 5 | 6 | To use Docker without having to type "sudo" with each command: 7 | ``` 8 | sudo groupadd docker 9 | sudo usermod -aG docker $USER 10 | ``` 11 | 12 | Then reboot to take effect. 13 | 14 | Install the required kernel modules for running the container: 15 | ``` 16 | sudo apt install linux-modules-extra-`uname -r` 17 | sudo modprobe binder_linux devices="binder,hwbinder,vndbinder" 18 | sudo modprobe ashmem_linux 19 | ``` 20 | 21 | ## ADB 22 | Install ADB to be able to connect to the device: 23 | ``` 24 | sudo apt-get install android-tools-adb 25 | ``` 26 | ### Example Helpful ADB Commands 27 | If you need to run as root on the device. You may need to reconnect to the device after this: 28 | ``` 29 | adb root 30 | ``` 31 | List the emulators that are running: 32 | ``` 33 | adb devices 34 | ``` 35 | If the device isn’t appearing (assuming the device is running on localhost port 5555): 36 | ``` 37 | adb connect 127.0.0.1:5555 38 | ``` 39 | ## Running the Emulator 40 | Redroid Docker for ARM Android: https://hub.docker.com/r/redroid/redroid 41 | ``` 42 | docker run -itd --privileged \ 43 | --name androidemu \ 44 | -v ~/data:/data \ 45 | -p 5555:5555 \ 46 | redroid/redroid:11.0.0-latest 47 | ``` 48 | If you did not make the modprobe commands persistent and the device is failing to start properly, you may need to run those previous commands one more time. 49 | 50 | To kill and remove the emulator: 51 | ``` 52 | docker container rm -f androidemu 53 | ``` 54 | 55 | ## Local Screen Connect 56 | To connect to the device screen, use SSH tunnelling to forward the ADB port on the Azure machine: 57 | ``` 58 | ssh -L 5555:127.0.0.1:5555 azureuser@AZURE_MACHINE_IP_ADDRESS 59 | ``` 60 | Now you can run ADB connect on your host machine and communicate with the remote device: 61 | ``` 62 | adb connect 127.0.0.1:5555 63 | adb devices 64 | ``` 65 | Install scrcpy on your host: https://github.com/Genymobile/scrcpy. Then run scrcpy to connect the device connected to ADB: 66 | ``` 67 | scrcpy.exe -s emulator-5554 # replace this with the name of the emulator 68 | ``` 69 | --------------------------------------------------------------------------------