Before Magisk became a thing, it was the Xposed Framework that largely shaped the device-neutral Android modding approach. Instead of having to unpack apps, modify bits and pieces, recompile, and push modified files to our devices, we can replace any method in any class at runtime with Xposed and a purpose-built module. The framework is basically a modification of
/system/bin/app_process Loads additional JAR files on startup, allowing developers to hook into the Zygote process and can act in its context.
Since Magisk offers an overlay-based modification mechanism (often referred to as “systemless”), a Magisk module can theoretically be created to manipulate the Zygote process without physical modification.
app_process Implementation of. This is where Riru comes in.
What is Riru?
Created by two developers named Rikka and yujincheng08, Riru is a specially designed Magisk module that provides Xposed-esque functionality without having to install the old school Xposed Framework. It is injected into Zygote to allow other modules to run their code in applications or the system server.
How does Riru work?
Riru’s initial implementation was based on replacing a specific system library called
libmemtrack. However, this method was later abandoned in favor of a property of the system known as “original bridge” (
ro.dalvik.vm.native.bridge). By exploiting the properties, developers can dynamically load and unload shared libraries of their choice, which ultimately leads to injection into the Zygote process.
How to download and install Riru?
As mentioned earlier, Riru is available as a Magisk module. Due to the fact that Magisk no longer comes with a built-in console browser, you need to download Riru directly from its GitHub repository.
After downloading the ZIP version file, you can install it using the Magisk app.
- If you are downloading on a PC or Mac, connect your Android device to it and copy the downloaded ZIP file to the internal memory of the target device.
- Open the Magisk app on your phone and go to File units Tab using the bottom navigation menu.
- Click on the button labeled Install from storage.
- Browse and select the ZIP module you downloaded earlier.
- Magisk will now install the module and prompt you to restart.
If all goes well, you can see Riru listed under File units Magisk app tab after restart.
What can I do with Riru?
Riru itself is just an entry for the other modules to connect to the Zygote process. As such, you need to install Riru-compatible modules via the Magisk app, just like any other Magisk modules. After successful installation, the Riru modules will be listed along with the Magisk modules in the Magisk app. You can then open the configuration interface of the module to modify its parameters. For modules without an interface, you can simply keep using the modified Android instance and Riru will take care of everything in the background.
What is the difference between Riru and Zygisk?
In newer versions of Magisk, you may encounter a situation where Riru gets disabled after installation due to Zygisk.
However, the reason behind this conflict is rather simple. Zygisk (as Magisk in Zygote) is Riru’s spiritual successor. It’s an evolution of the unregulated interface that topjohnwu the recognized developer at XDA (ie the creator of Magisk) and many other developers has been working on for a while. Since both Riru and Zygisk target the Android Zygote process, these two cannot exist simultaneously. However, you can disable Zygisk from Magisk setup, restart the device, and then enable Riru.
As a matter of fact, Riru’s moderators practically stopped developing the project a while ago. They suggested that unit developers switch to Zygisk in the future. However, Zygisk is still in its infancy stage and there is a lot of room for improvement, so the migration process will take some time. In the meantime, you can continue to use Riru and its modules.