Before Magic became a thing, it was the Xposed Framework that largely shaped the device-agnostic Android modding approach. Instead of having to decompile applications, modify bits and pieces, recompile and push the modded files back to our devices, we can replace any method in any class while running using Xposed and a custom module. The frame is essentially a modification of
/system/bin/app_process to load additional JAR files at startup, allowing developers to join the Zygote process and act in its context.
Since Magic offers an overlay-based modding mechanism (often referred to as “systemless”), one can theoretically create a Magic module to tinker with the Zygote process without physically changing
app_process executable. This is where Riru comes in.
What is Riru?
Created by two developers named Rikka and yujincheng08, Riru is a specially designed Magic module that offers Xposed-like features without the need to install the old Xposed Framework. It injects into Zygote to allow other modules to run their codes in the apps or system server.
How does Riru work?
The initial implementation of Riru was dependent on the replacement of a specific system library called
libmemtrack. However, the method was later abandoned in favor of a system property known as “the original bridge” (
ro.dalvik.vm.native.bridge). By leveraging the feature, developers can dynamically load and unload shared libraries of their choice, ultimately leading to injection into the Zygote process.
How to download and install Riru?
As previously mentioned, Riru is available as a Magic module. Due to the fact that the Magic app no longer comes with a built-in modular browser, you need to download Riru directly from its GitHub repository.
After downloading the release zip file, you can install it using the Magic app.
- If you are downloading on a PC or Mac, connect your Android device to it and copy the downloaded ZIP file to the target device’s internal memory.
- Open the Magic app on your phone and switch to Modules tab using the bottom navigation menu.
- Press the named button Install from stock.
- Browse and select the ZIP module you downloaded earlier.
- Magic will now install the module and ask you to reboot.
If all goes well, you can see Riru listed below Modules tab in the Magic app after reboot.
What can I do with Riru?
Riru itself is just a doorway for other modules to join the Zygote process. As such, you must install Riru-compatible modules through the Magic app, just like any other Magic module. After a successful installation, Riru modules will be listed along with Magic modules in the Magic app. You can then open the module-specific configuration frontend to change its parameters. For those modules that have no interface, you can just keep using your modded Android instance and Riru will take care of everything in the background.
What is the difference between Riru and Zygisk?
On newer versions of Magic you may face a situation where Riru is disabled after installation due to the presence of Zygisk.
However, the reason behind this conflict is quite simple. Zygic (e.g., Magic in Zygote) is the spiritual successor to Riru. It’s the development of the systemless interface that XDA Senior Recognized Developer topjohnwu (ie the creator of Magic) and several other developers have been working on for some time. Since both Riru and Zygisk target the Android Zygote process, these two cannot coexist. However, you can disable Zygic from the Magic setting, restart the device, and then enable Riru.
In fact, Riru’s maintainers virtually stopped developing the project a while ago. They suggested module developers switch to Zygisk in the future. However, zygean is still in an incipient stage and there are plenty of opportunities for improvement, therefore the migration will take time. In the meantime, you can continue to use Riru and its modules.