Genymotion recently moved root access behind a paywall, making it a premium feature. However, if you're using Genymotion for Android development, testing, or educational purposes, having root access can be essential. Root access allows developers to access deeper functionality, test root-only features, and explore Android's internals without restrictions.
The good news is that with a bit of work, you can still enable root on a Genymotion emulator if you have access to its disk image and platform keys. This guide walks you through the process of adding a custom system app, RootToggle, which will allow you to switch root access on and off without needing Genymotion's paid root access feature.
This Gist details the steps to compile, sign, and install RootToggle as a system app in a Genymotion emulator by directly modifying the emulator's disk image IN LINUX (use a virtual machine on Windows to do that).
- RootToggle-signed.apk — Ready-to-use signed APK
- RootToggle.zip — Source code (optional, for self-compilation)
- This guide
- Linux environment (use a VM on Windows/macOS)
- qemu-utils — for
qemu-nbd(sudo apt install qemu-utils) - Android SDK Build Tools — only needed if compiling the APK yourself
Note
Does this work in WSL? I haven't tested it. If you try, please let me know in the comments!
If you prefer to compile the RootToggle app yourself, follow these steps:
-
Get the source: Download source.zip
-
Build the APK: Open the project in Android Studio and build the APK, or use the Gradle command line.
./gradlew assembleRelease
-
Locate the Unsigned APK: After building, the unsigned APK will be in the
app/build/outputs/apk/releasedirectory.
You will need platform.pk8 and platform.x509.pem keys for the emulator from this official repo here. If for some reason this repo doesn't exist anymore, you could get it here.
git clone https://github.com/Genymobile/genymotion_platform_vendor_genymotion_security_public
cp genymotion_platform_vendor_genymotion_security_public/release-keys/platform* .Run the following command to sign the APK:
/path/to/build-tools/<version>/apksigner sign \
--key platform.pk8 \
--cert platform.x509.pem \
--out RootToggle-signed.apk \
app/build/outputs/apk/release/app-release-unsigned.apkThe signed APK is now ready to be installed as a system app.
Using QEMU and qemu-nbd, we’ll add the signed APK to the Genymotion emulator’s system partition.
Warning
Make sure the Genymotion emulator is completely stopped before modifying the disk image. Editing while running can corrupt the image.
-
Load the NBD (Network Block Device) Module:
sudo modprobe nbd
-
Attach the QCOW2 Disk Image:
sudo qemu-nbd --connect=/dev/nbd0 ~/.Genymobile/Genymotion/deployed/<device_name>/system.qcow2
[!NOTE] The path may vary depending on your setup:
- Deployed VMs:
~/.Genymobile/Genymotion/deployed/<device_name>/system.qcow2 - System images:
~/.Genymobile/Genymotion/system-images/<image_version>/<android_version>/system.qcow2
macOS users: Copy
system.qcow2to a Linux machine to modify it. After editing, copy it back to thesystem-imagesfolder (notdeployed), asdeployedimages are regenerated fromsystem-images. - Deployed VMs:
-
Identify the System Partition:
Run
sudo fdisk -l /dev/nbd0to find the correct partition. Look for a partition labeledsystemor the largest ext4 partition (typically 2-4 GB). It's usually/dev/nbd0p4. -
Mount the System Partition:
sudo mkdir -p /mnt/android_system sudo mount /dev/nbd0p4 /mnt/android_system
-
Create the App Directory:
sudo mkdir -p /mnt/android_system/system/priv-app/RootToggle
-
Copy the Signed APK:
sudo cp RootToggle-signed.apk /mnt/android_system/system/priv-app/RootToggle/RootToggle.apk
-
Set the Correct Permissions:
sudo chmod 644 /mnt/android_system/system/priv-app/RootToggle/RootToggle.apk
-
Unmount and Disconnect:
sudo umount /mnt/android_system sudo qemu-nbd --disconnect /dev/nbd0
Tip
If mounting fails or you encounter errors, make sure to disconnect nbd first:
sudo qemu-nbd --disconnect /dev/nbd0Start your Genymotion emulator as usual. The RootToggle app should now be installed as a system app with the necessary permissions to modify persist.sys.root_access.
The qcow2 path
~/.Genymobile/Genymotion/system-images/${image_version}/${android_version}/system.qcow2When you use Genymotion on mac, copy system.qcow2 to a linux to mod, you must copy
system.qcow2insystem-images.