Installing Magisk and LSPosed on emulated Android

After attempting many different ways of getting Magisk to run on Android emulators (including Waydroid and the like), the only way that worked is using the official emulator from Google, along with the instructions from the following Gist:



Here are the command-line flags I use to start the emulator:

emulator @android14-play \
    -memory 16384 \
    -no-audio \
    -feature -Vulkan \
    -gpu host \
    -ramdisk ~/.android/avd/android14-play.avd/ramdisk-patched.img

Note: I used to specify the number of emulated CPU cores like so: -cores 8. But for whatever reason, this breaks snapshot functionality.

Userspace installation

After getting the emulated device up and running with a patched ramdisk.img, finish setting up Magisk as follows:

  1. Install Magisk by sideloading the APK: adb install Magisk-v27.0.apk. See the GitHub releases page.

  2. Open up Magisk. (Note that the app may not show up in the apps list until Android initial setup has completed.) Follow the prompt requesting for a reboot to perform “additional setup”.

  3. Copy the LSPosed zygisk ZIP over to the device: adb push /sdcard/Download/. LSPosed is no longer under development, so download the last available release from GitHub.

  4. Open up Magisk and select the Modules tab. Choose “Install from storage” and select the LSPosed ZIP file. After installing, you will be prompted to reboot again.

  5. After rebooting, you should have a silent notification “LSPosed loaded”. Tap to open the LSPosed interface, and choose whether you want to add an app shortcut.

  6. Now you can search for modules in the “Repository” tab and install them!