How to root an Android Virtual Device
Rooting Android Emulator (AVD) with rootAVD on (Mac - Apple Silicon)
How to root an Android Virtual Device
Prerequisites
- Android Studio installed
- AVD (Android Emulator) created
- Prefer API 33 (Android 13) with Google APIs (NOT Play Store)
- ADB working (
adb devicesshould show emulator)
Step-by-Step Guide
1. Clone rootAVD
1
2
git clone https://gitlab.com/newbit/rootAVD.git
cd rootAVD
2. Setup Android SDK Path
1
2
export ANDROID_HOME=~/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
Verify:
1
adb devices
3. Start Emulator
Start from Android Studio or CLI:
1
emulator -avd AVD_NAME
Wait until fully booted.
4. Ensure Only Emulator Connected
1
adb devices
If other devices exist:
1
adb disconnect
5. Add Latest Magisk
- Download latest Magisk APK: https://github.com/topjohnwu/Magisk
- Rename to:
1
Magisk.zip
- Place inside
rootAVDfolder
6. Run rootAVD Script
1
./rootAVD.sh system-images/android-33/google_apis/arm64-v8a/ramdisk.img
7. Emulator Crash / Not Starting Fix
Kill stuck process:
1
2
3
4
killall -9 emulator
killall -9 adb
adb kill-server
adb start-server
Start clean:
1
emulator -avd AVD_NAME -wipe-data -no-snapshot
Important Tips
- Disable Snapshot / Quick Boot
- Always use Cold Boot
- API 33 is most stable for rootAVD
- Use
arm64-v8afor Apple Silicon
Done!
Your emulator should now be rooted with Magisk.
You can verify:
1
adb shell su
Enable ADB Root Access (Important)
After setup, you may see:
1
su → Permission denied
or a toast:
“Shell was denied Superuser rights”
Fix:
- Open Magisk app inside emulator
- Go to Superuser
- Find:
1
Shell (com.android.shell)
- Change permission to:
1
Allow / Grant
Alternative Quick Trigger
1
adb shell su -c id
Then tap Allow in Magisk popup
Recommended Setting
Magisk → Settings:
1
Superuser Access → Apps and ADB
Verify Root
1
2
3
adb shell
su
whoami
Expected:
1
root
This post is licensed under CC BY 4.0 by the author.