8.0 KiB
outline, description
| outline | description | ||
|---|---|---|---|
|
Deploy a cloud Android emulator using redroid on Olares, and access the Android host from macOS and Windows via adb and scrcpy. |
Host your cloud Android with redroid
redroid (Remote Android) is a GPU-accelerated Android-in-Cloud (AIC) solution that integrates seamlessly with Olares. You can easily host high-performance Android instances on your Olares and access them anytime to run Android games, apps, or even automation tests.
This tutorial walks you through installing redroid on Olares and accessing the Android instance from Windows and macOS.
Objectives
By the end of this tutorial, you will learn how to:
- Install the required Linux kernel modules on the Olares host.
- Install the redroid app on Olares and get the service URL.
- Connect and operate the Android instance from Windows and macOS, using
adbandscrcpy. - Install APK apps on the Android instance.
Before you begin
Make sure the following requirements are met:
-
Olares is installed and running on a Linux machine. ::: tip Configuration requirements
- redroid is only supported on Linux. Make sure your Olares instance is running on a Linux system.
- redroid is resource-intensive. For best performance, we recommend using a machine with at least an 8-core CPU and 16GB of RAM. :::
-
Enable LarePass VPN on your device.
Install dependent kernel modules
redroid requires specific kernel modules to run on Linux. For details, refer to the official redroid docs.
For example, on Ubuntu, you can install the required kernel modules by running the following commands in the terminal:
sudo apt install linux-modules-extra-`uname -r`
sudo modprobe binder_linux devices="binder,hwbinder,vndbinder"
# This command might fail on newer kernels; the error can be safely ignored.
sudo modprobe ashmem_linux
Install redroid on Olares
redroid runs as a headless backend on Olares. To install redroid:
-
In Olares Market, find redroid under "Utilities", and click Get. redroid will launch automatically after installation.
-
Get the URL to access the redroid service:
a. From Olares Desktop, navigate to Settings > Application > redroid.
b. In Entrances > Set up endpoint, get the base domain of redroid, e.g.,
beb583c3.<olares_id>.olares.com.c. Append the exported port of redroid (
46878) to the base domain.Here is an example of our final URL to access the redroid service:
beb583c3.olares01.olares.com:46878.
Connect to the redroid service
To access the Android instance on Olares, you'll need to connect to the redroid service using adb and render the UI using scrcpy.
The Windows version comes bundled with adb, so you don't need to install it separately.
-
Download the Windows version of
scrcpyfrom the project website and extract it to a specific folder.::: tip adb version conflict If another version of
adbis installed, it may cause conflicts betweenadbservers. Uninstall the old version or replace it with the bundled version inscrcpy. ::: -
Open PowerShell, then navigate to the
scrcpydirectory:# Replace with the acutal path cd .\scrcpy-win64-v3.1 -
Use
adbto connect to the redroid service via the URL obtained earlier:.\adb.exe connect beb583c3.<olares_id>.olares.cn:46878The connection is successful if you see the example output:
# Example output already connected to beb583c3.<olares_id>.olares.cn:46878 -
Render UI and audio using
scrcpy:.\scrcpy.exe -s beb583c3.<olares_id>.olares.cn:46878 --audio-codec=aac --audio-encoder=OMX.google.aac.encoderUpon successful execution, the command line outputs the device and rendering info. And the Android screen pops up.
On macOS, scrcpy does not include adb by default, so you'll need to install them separately. It is recommended to install them via Homebrew.
-
Install
scrcpy:brew install scrcpy -
Install
adb:brew install --cask android-platform-tools -
Verify the installation:
scrcpy --version adb versionInstallation is successful if you see the version numbers.
:::tip Gatekeeper alert If blocked by macOS security, go to System Settings > Privacy & Security > Security, find the corresponding item, and click Allow Anyway. You will be promoted to enter your password when re-running the command. :::
-
Connect to the redroid service URL obtained earlier via
adb:adb connect beb583c3.<olares_id>.olares.cn:46878The connection is successful if you see the example output.
# Example output already connected to beb583c3.<olares_id>.olares.cn:46878 -
Render UI and audio using
scrcpy:scrcpy -s beb583c3.<olares_id>.olares.cn:46878 --audio-codec=aac --audio-encoder=OMX.google.aac.encoderUpon success, the command line outputs the device information. The Android screen pops up.
Install APK
Once connected, you can use adb to install third-party APK apps on the Android instance.
-
Get the details of all connected devices:
.\adb.exe devices -lGet the
transport_idof the device, which is4in our case:# Example output List of devices attached beb583c3.<olares_id>.olares.com:46878 device product:ziyi model:23031PN0DC device:ziyi transport_id:4 -
Install the APK to the specified device. Use
-tto specify the transport ID:.\adb.exe -t 4 install C:\Users\YourName\Downloads\your_app.apk\The installation is successful if you see the following message:
# Expected output Performing Streamed Install Success
-
Get the details of all connected devices:
adb devices -lGet the
transport_idof the device, which is4in our case:# Example output List of devices attached beb583c3.<olares_id>.olares.com:46878 device product:ziyi model:23031PN0DC device:ziyi transport_id:4 -
Install the APK to the specified device. Use
-tto specify the transport ID:adb -t 4 install ~/Downloads/your_app.apkThe installation is successful if you see the following message:
# Expected output Performing Streamed Install Success
After installation, run scrcpy again to render the Android screen. Swipe up to see the installed APK.
Common adb commands
:::tip Note
The following commands are for macOS and Linux. On Windows, replace adb with adb.exe.
:::
# Start adb server
adb start-server
# Connect to a device
adb connect <url>:<port>
# List connected devices
adb devices
# Disconnect a device
adb disconnect <url>:<port>
# Install an APK by transport_id
adb -t 3 install your_app.apk
# View real-time logs
adb logcat
# Export logs to a file
adb logcat -v time > log.txt
# Push a file to the device
adb push <local_path> <device_path>
# Pull a file from the device
adb pull <device_path> <local_path>
# List directory contents on device
adb shell ls <path>
# View file contents
adb shell cat <file_path>
# Reboot the device
adb shell reboot
# Shut down the device
adb shell reboot -p

