赵小福

赵小福

Build your own cloud phone using Redroid.

Lately, I've been using cloud phones a lot for gaming, and I happen to have an idle cloud server on hand, so I thought I'd build my own cloud phone to play around with.

At the time of writing this article, Alibaba Cloud's Shadowless Cloud Computer offers a three-month free trial, with a configuration of 4 cores and 8GB of Ubuntu 20 system (Amd64 architecture). It's currently idle, so I decided to tinker with it.

The solution I used to build the cloud phone is Redroid, deployed through Docker, and controlled remotely using Scrcpy.

Prerequisites#

  • Cloud server (recommended 2C4G or higher) Amd64 or Arm architecture, Arm architecture is preferred
  • Knowledge of how to use Scrcpy

My Environment#

  • Ubuntu 20.04
  • 4 cores, 8GB RAM, 4M bandwidth (Amd64 architecture)
Docker Hub:
https://hub.docker.com/r/redroid/redroid

Installation on Windows 10:
https://github.com/remote-android/redroid-doc/blob/master/deploy/wsl.md

Blog Reference:
https://blog.hanlin.press/2022/08/play-redroid-on-oracle-cloud/

1. Getting Started with Installation#

Install Docker#
sudo apt-get install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker
Docker Image (optional)#
# If installing Redroid with Docker is too slow, you can try modifying the image source (no guarantee of effectiveness)
sudo vim /etc/docker/daemon.json

{
 "registry-mirrors": ["https://docker.mirrors.tuna.tsinghua.edu.cn"]
}

sudo systemctl daemon-reload
sudo systemctl restart docker
Install Dependencies#
sudo apt install linux-modules-extra-`uname -r`
sudo modprobe binder_linux devices="binder,hwbinder,vndbinder"
sudo modprobe ashmem_linux
Install adb#
sudo apt install adb
Install Scrcpy#
# Install via snap (slower installation)
snap install scrcpy

# Install via apt (older version)
apt install scrcpy

2. Run Docker and Install Redroid#

docker run -itd --rm --privileged \
    --pull always \
    -v ~/data:/data \
    -p 5555:5555 \
    redroid/redroid:11.0.0-latest

If you want to add some phone attributes to the cloud phone to make it more like a real phone and avoid some game restrictions, you can execute the following command to start the container.

docker run -itd --rm --memory-swappiness=0 \
    --privileged --pull always \
    -v /data:/data \
    -p 5555:5555 \
    redroid/redroid:11.0.0-latest \
    androidboot.hardware=mt6891 ro.secure=0 ro.boot.hwc=GLOBAL ro.ril.oem.imei=861503068361145 ro.ril.oem.imei1=861503068361145 ro.ril.oem.imei2=861503068361148 ro.ril.miui.imei0=861503068361148 ro.product.manufacturer=Xiaomi ro.build.product=chopin \
    redroid.width=720 redroid.height=1280 \
    redroid.gpu.mode=guest

This image is about 800MB in size. If there are network issues during image pulling (Docker Hub is slow in China), resulting in a failed pull, you can leave a message in my public account: Redroid Image, to get the Redroid Docker image.

Once you have the image, you can import it locally instead of pulling it remotely. If you don't know how to do this, you can message me for a tutorial.

3. Connect using adb#

# If it's a remote machine, change localhost to the corresponding IP
adb connect localhost:5555

4. Connect with scrcpy#

# Connect to a single device
scrcpy

# Connect to multiple devices by specifying the IP
scrcpy -s localhost:5555

Successful Connection, Launching Redroid

5. Install Applications#

To install applications, simply drag and drop the APK file into the scrcpy window, and the terminal will output a log.

Swipe up from the bottom to open the app list#

Open App List

6. Redroid Installation Complete, Install Magisk to Manage Root Access on the Cloud Phone#

If you want to manage the root access of the cloud phone and grant root access to apps that require it, you can flash Magisk to achieve this.

You can easily install Magisk using the reference document mentioned above. If you're not sure how to do it, feel free to leave me a message, and I'll write a root tutorial later.

Reference Document:
https://gist.github.com/assiless/a23fb52e8c6156db0474ee8973c4be66
Magisk Installation Successful#

Magisk

Install Devcheck to View Phone Configuration#

Devcheck

Hardware Configuration

Final Thoughts#

Alibaba Cloud's Shadowless Cloud Computer is a computer with Amd64 architecture. The best solution for building a cloud phone is to use a server with Arm architecture (eliminating the need for Amd64 to Arm instruction conversion, which greatly improves performance). However, Arm architecture servers from domestic cloud hosting providers are very expensive and do not offer free trials.

The only option available is the Oracle cloud server (https://cloud.oracle.com/), which provides a 4-core, 24GB RAM Arm cloud server and offers a permanent free trial (this configuration is better than most real smartphones for building a cloud phone).

However, due to too many people taking advantage of the free trial, the servers are always in short supply, so it's difficult to get one. If you're interested, you can try your luck and register an account. When registering, avoid choosing popular regions like South Korea and Japan, as resources are scarce in those areas.

Reminder for Oracle Account Registration: You need a credit card that supports foreign currency payments for identity verification, which can be obtained from many banks. You don't need to use a VPN proxy, and the address you provide should be a real address (it's recommended to use your credit card billing address).

If registration fails, you can try switching to a mobile network, changing browsers (or opening the browser's incognito mode), and trying multiple times.

Arm Server
Choose Arm Instance

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.