In this article, let’s see how to install Magisk on an Android emulator – both official Android emulator and Android x86 Project on VirtualBox.
Install Magisk On Official Android Emulator
Works on Android API 22 – 30,S (except 28)
- Grab Magisk.zip (or Magisk.apk) and put in this directory. If you’re using ARM system image, replace
- For patching the ramdisk with magisk, your AVD must be already created
- Make sure you backup the untouched
<sdk_home>/system-images/<platform>/*/ramdisk.img. You will need it everytime you want to patch ramdisk with magisk (for the first time and also for subsequent magisk updates).
- Clone this repository and copy the original
ramdisk.imginto the clone’s folder.
- Start the newly created AVD.
- There are three ways to patch ramdisk:
patch.batto install Magisk (pre-downloaded) on the ramdisk.img
- Alternatively, you can execute
patch.bat canaryto install latest canary Magisk on the ramdisk.img. This requires AVD internet connectivity towards github. Note: If choosing to use ‘patch.sh’, you might need to run
dos2unix patch.shfirst so that the script has propper line ending. This is needed when using for example github for desktop, which changes line ending to CRLF instead of LF
- If you prefer patching by MagiskManager, execute
patch.bat manager, it will create a fake
boot.imgon internal storage. We then launch MagiskManager and click
boot.imgto patch it. When finished, execute
patch.bat pullto get the patched ramdisk.img. This method is mainly for Released version of Magisk.
- When finished, copy the patched
ramdisk.imgback to AVD directory.
- Power off and restart (cold start) the emulator
- Recommended: update magisk manager
- Enjoy Magisk 🙂
Install Magisk On Android x86 Project on VirtualBox
Only test on Android 8.1
- Grab Magisk.zip (or Magisk.apk) and put in this directory.
- Bring up Android system and establish adb connection.
prepare_image.batto grab initrd.img and ramdisk.img on hard drive.
patch_vbox.batto patch initrd.img and ramdisk.img
install_vbox.batto install patched images on hard drive.
- Restart machine and enjoy Magisk 🙂
|Emulator Version||command-line patch||manager patch|
|Android S||Canary (22001)||Canary (22001, w/ built-in |
|Android 22 – 30||Canary (22001)||21.4 (w/ manager 8.0.7)|