redroid (Remote Android) Documentation
repository·master·Indexed 27 days ago
https://github.com/remote-android/redroid-docDocumentation for redroid, a GPU-accelerated Android-in-Cloud (AIC) solution for running multiple Android instances as Docker containers on Linux. It supports arm64 and amd64 architectures for cloud gaming, automation testing, and virtualized phone environments. Includes guides on building from source using the redroid-builder Docker image, integrating GApps, deploying via Docker/Podman, and connecting via ADB and scrcpy.
What's inside redroid
- redroid is a project related to AOSP (Android Open Source Project) tools. It provides resources and mirrors for AOSP development.
Add binder devices on Debian
masterTo run redroid on Debian, you must ensure the binder devices are available and have the correct permissions. Use
modprobeto load thebinder_linuxmodule with specific device nodes and then set the permissions to666.modprobe binder_linux devices=binder1,binder2,binder3,binder4,binder5,binder6 chmod 666 /dev/binder*Deploy redroid on Deepin 23
masterTo deploy redroid on Deepin 23, first install
podmanusing the system package manager. Then, create a data directory and run the redroid container usingpodman runwith privileged access and port mapping.# Install podman apt install podman # Start redroid mkdir ~/data11 podman run -itd --rm --privileged \ --pull always \ -v ~/data11:/data \ -p 5555:5555 \ --name redroid11 \ redroid/redroid:12.0.0_64only-latestBuild the redroid builder Docker image
masterCreate a Docker image named
redroid-builderthat includes the necessary environment for building Android. The build process passes your host's user and group IDs to ensure file permissions are handled correctly within the container.docker build --build-arg userid=$(id -u) --build-arg groupid=$(id -g) --build-arg username=$(id -un) -t redroid-builder .Set up the environment to build Redroid with Docker
masterBefore building, ensure you have approximately 200GB to 250GB of free disk space. This setup involves installing system packages, configuring
repo, setting up Git, and configuring Docker permissions.Note: After adding your user to the
dockergroup, you must logout and login again for the changes to take effect.# update and install packages sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install -y curl libxml2-utils docker.io docker-buildx git-lfs jq sudo apt-get remove repo -y && sudo apt-get autoremove -y # install 'repo' mkdir -p ~/.bin curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo chmod a+x ~/.bin/repo echo 'export PATH=~/.bin:$PATH' >> ~/.bashrc && source ~/.bashrc # set git variables git config --global user.email "you@example.com" git config --global user.name "Your Name" # add current user to Docker group sudo usermod -aG docker ubuntu # Replace 'ubuntu' with your username sudo systemctl enable docker sudo systemctl restart dockerDeploy redroid on Fedora 38
masterTo deploy redroid on Fedora 38, you must first disable SELinux and then run the docker container.
- Disable SELinux: Use
grubbyto update kernel arguments and regenerate the grub configuration, then reboot. - Run redroid: Use
docker runwith the following configuration:--privileged: Required for redroid to function.--pull always: Ensures the latest image is used.-v ~/data11:/data: Mounts a local directory to the/datapartition.-p 5555:5555: Exposes the ADB port.--name redroid11: Assigns the container name.
# Disable SELinux grubby --update-kernel ALL --args selinux=0 grub2-mkconfig > /boot/grub2/grub.cfg reboot # Start redroid docker run -itd --rm --privileged \ --pull always \ -v ~/data11:/data \ -p 5555:5555 \ --name redroid11 \ redroid/redroid:12.0.0_64only-latest- Disable SELinux: Use
Fetch and prepare redroid source code
masterTo build redroid, you must first initialize the Android source tree, add local manifests, sync the code, and apply redroid-specific patches.
Note: Ensure you check the supported branch in
https://github.com/remote-android/redroid-patches.gitbefore starting.# 1. Initialize repo with Android manifest mkdir ~/redroid && cd ~/redroid repo init -u https://android.googlesource.com/platform/manifest --git-lfs --depth=1 -b android-11.0.0_r48 # 2. Add local manifests git clone https://github.com/remote-android/local_manifests.git ~/redroid/.repo/local_manifests -b 11.0.0 # 3. Sync code repo sync -c # 4. Apply redroid patches git clone https://github.com/remote-android/redroid-patches.git ~/redroid-patches ~/redroid-patches/apply-patch.sh ~/redroidApply Redroid patches and start the Docker builder
masterApply the necessary Redroid patches to the source code and launch the Docker container used for the build process.
# Apply redroid patches git clone https://github.com/remote-android/redroid-patches.git ~/redroid-patches ~/redroid-patches/apply-patch.sh ~/redroid # Build and run the builder container docker buildx create --use docker buildx build --build-arg userid=$(id -u) --build-arg groupid=$(id -g) --build-arg username=$(id -un) -t redroid-builder --load . docker run -it --privileged --rm --hostname redroid-builder --name redroid-builder -v ~/redroid:/src redroid-builderBuild redroid with GApps (Mind The Gapps)
masterTo include GApps in your redroid build, follow these steps:
- Add Manifest: Create
.repo/local_manifests/mindthegapps.xml. Use revisionrhofor Redroid 11 orsigmafor Redroid 12. - Modify device.mk: Add the GApps path to
device/redroid/redroid_ARCHITECTURE/device.mkusing the$(call inherit-product, ...)syntax. - Sync and Build: Run
repo sync -cand proceed with the standard build process.
Tip: To skip the GApps setup wizard, use the entrypoint:
ENTRYPOINT ["/init", "androidboot.hardware=redroid", "ro.setupwizard.mode=DISABLED"]during thedocker importstep.<!-- Example .repo/local_manifests/mindthegapps.xml --> <?xml version="1.0" encoding="UTF-8"?> <manifest> <remote name="mtg" fetch="https://gitlab.com/MindTheGapps/" /> <project path="vendor/gapps" name="vendor_gapps" revision="sigma" remote="mtg" /> </manifest># Example addition to device/redroid/redroid_x86_64/device.mk $(call inherit-product, vendor/gapps/x86_64/x86_64-vendor.mk)- Add Manifest: Create
Install LXC tools and dependencies for redroid deployment
masterInstall the necessary LXC utilities, OCI template tools, and networking dependencies required to manage redroid containers.Configure kernel features for redroid on x86_64 CentOS
masterTo run redroid on x86_64 CentOS, ensure your kernel is compiled with the following configuration options. These enable essential features like DMA-BUF heaps, ashmem, and binderfs.
# codec2 required, can use ION for legacy kernel CONFIG_DMABUF_HEAPS=y CONFIG_DMABUF_HEAPS_SYSTEM=y # optional, can use memfd CONFIG_STAGING=y CONFIG_ASHMEM=y # binderfs required CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y CONFIG_ANDROID_BINDERFS=y CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"Fetch and sync Android and Redroid source code
masterInitialize the Android manifest and sync the source code. This process requires approximately 100GB of data and about 20 minutes on a fast connection. You must also download the Redroid Dockerfile and verify thatWebview.apkfiles were correctly synced viagit-lfs(they should be at least ~80MB each).