Riru only does one thing, inject into zygote in order to allow modules to run their codes in apps or the system server.
Requirements
Android 6.0+ devices rooted with Magisk
Guide
Install
- From Magisk Manager- Search “Riru” in Magisk Manager
- Install the module named “Riru”The Magisk version requirement is enforced by Magisk Manager. You can check Magisk’s module installer script.
 
- Manually- Download the zip from the downloads section.
- Install in Magisk Manager (Modules – Install from storage – Select downloaded zip)
 
Common problems
- Third-party ROMs have incorrect SELinux rulehttps://github.com/RikkaApps/Riru/wiki/Explanation-about-incorrect-SELinux-rules-from-third-party-ROMs-cause-Riru-not-working
- Have low quality module that changes ro.dalvik.vm.native.bridgeinstalledIf you are using other modules that changero.dalvik.vm.native.bridge, Riru will not work. (Riru will automatically set it back)A typical example is, some “optimize” modules change this property. Since changing this property is meaningless for “optimization”, their quality is very questionable. In fact, changing properties for optimization is a joke.
How Riru works?
- How to inject into the zygote process?Before v22.0, we use the method of replacing a system library (libmemtrack) that will be loaded by zygote. However, it seems to cause some weird problems. Maybe because libmemtrack is used by something else.Then we found a super easy way, the “native bridge” (ro.dalvik.vm.native.bridge). The specific “so” file will be automatically “dlopen-ed” and “dlclose-ed” by the system. This way is from here.
- How to know if we are in an app process or a system server process?Some JNI functions (com.android.internal.os.Zygote#nativeForkAndSpecialize&com.android.internal.os.Zygote#nativeForkSystemServer) is to fork the app process or the system server process. So, we need to replace these functions with ours. This part is simple, hookjniRegisterNativeMethodssince all Java native methods inlibandroid_runtime.sois registered through this function. Then we can call the originaljniRegisterNativeMethodsagain to replace them.
How does Hide works?
From v22.0, Riru provides a hidden mechanism (idea from Haruue Icymoon), make the memory of Riru and module to anonymous memory to hide from “/proc/maps string scanning”.
Build
Gradle tasks:
- :riru:assembleDebug/ReleaseGenerate Magisk module zip to- out.
- :riru:pushDebug/ReleasePush the zip with adb to- /data/local/tmp.
- :riru:flashDebug/ReleaseFlash the zip with- adb shell su -c magisk --install-module.
- :riru:flashAndRebootDebug/ReleaseFlash the zip and reboot the device.
Download Riru Core Magisk Module
You can get the latest version of Riru Core by clicking the below link:
Latest Version
v26.1.7
v26.1.7 (2022-09-11)
- THIS IS THE LAST RELEASE. MODULES AND USERS SHOULD MIGRATE TO ZYGISK.
- Skip stack protector after fork from Zygote
v26.1.6 (2022-05-20)
- THIS IS THE LAST RELEASE. MODULES AND USERS SHOULD MIGRATE TO ZYGISK.
- Fix some parameter of nativeSpecializeAppProcesscannot be modified
v26.1.5 (2022-02-02)
- THIS IS THE LAST RELEASE. MODULES AND USERS SHOULD MIGRATE TO ZYGISK.
- Fix description hint
Just one last dance Before we say goodbye When we sway and turn round and round and round It's like the first time
Here’s all the available versions:
v26.1.7
v26.1.7 (2022-09-11)
- THIS IS THE LAST RELEASE. MODULES AND USERS SHOULD MIGRATE TO ZYGISK.
- Skip stack protector after fork from Zygote
v26.1.6 (2022-05-20)
- THIS IS THE LAST RELEASE. MODULES AND USERS SHOULD MIGRATE TO ZYGISK.
- Fix some parameter of nativeSpecializeAppProcesscannot be modified
v26.1.5 (2022-02-02)
- THIS IS THE LAST RELEASE. MODULES AND USERS SHOULD MIGRATE TO ZYGISK.
- Fix description hint
Just one last dance Before we say goodbye When we sway and turn round and round and round It's like the first time
26.1.4
v26.1.4 (2021-12-15)
- Skip launching Rirud when Zygisk is enabled
- Fix sonextupdate during hiding
26.1.3
v26.1.3 (2021-10-08)
- Call android_create_namespaceon Android 8.0+
26.1.2
v26.1.2 (2021-09-04)
- Speedup Rirud launch
- Warning about incorrect SELinux policy
- No warning about Rirud socket closed
- Use getprognameto detect zygote
26.1.1
v26.1.1 (2021-08-18)
- Fix reset native bridge
26.1.0
v26.1.0 (2021-08-16)
- Preload modules parallelly to speedup startup
- Fix status showing after a soft reboot
- Fix riru is not loading after a soft reboot
- Prevent modules from using internal interfaces
- Stricter authorization of Rirud
- More accurate loaded status
- Fix status showing on Huawei and Samsung devices
- Unshare Rirud
v26.0.5
v26.0.5 (2021-08-01)
- Fix killing parent process
v26.0.4 (2021-07-30)
- 
Fix flock not working on some devices This is a bug from Magisk's busybox and it will be fixed here. As a workaround, we set SHELLin the script manually.
v26.0.3 (2021-07-27)
- 
Reset SELinux context for module files when necessary This will not always work since on ROMs with incorrect SELinux rules, the system will reset module file to the incorrect one at the same time 
v26.0.2 (2021-07-27)
- Report if the SELinux context of the module files are incorrect
- Use Resources for i18n
v26.0.1 (2021-07-18)
- Remove support for pre-v24 modules (it has been more than 4 months and all live modules have upgraded to v24+)
- Display status on module description in Magisk (app is removed because of this)
- Combine rirudwithrirud_java
- Refactor codes
- riru-v26.0.5.r484.a8c93a12f8-debug.zip 480.08 KB 14,747 downloads
- riru-v26.0.5.r484.a8c93a12f8-release.zip 166.82 KB 17,400 downloads
- Source code
v25.4.4
- Fix in rare cases "soft boot" causes Riru not working
- Fix keep allow_install_appflag (#225)
- riru-v25.4.4-debug.zip 2.84 MB 73,620 downloads
- riru-v25.4.4-release.zip 229.95 KB 124,985 downloads
- Source code
v25.4.3
- Exit service.shscript
- Use uid 0 to install the app
v25.4.2
- "Fix" system server injection does not work on Huawei devices by setting ro.maple.enableto0
v25.4.1
- Report and abort installation if the ROM has incorrect SELinux rules [1]
- Bundle app with the module (Create file /data/adb/modules/riru-core/allow_install_appto allow the module to install the app)
v25.3.4
- Unload API 25+ modules in the app process if the module does not provide related functions
- Fix possible crash caused by pmparser.c(#202)
- Use self-compiled libcxx (https://github.com/topjohnwu/libcxx)
v25.3.3
- Fix crash on Android 8.0 again
v25.3.2
Important changes from the last stable version (v23.9)
- Unify the Riru API version and Riru version, Riru 25 stands for API version 25
- For modules that have adapted Riru API 24+, lib files are loaded from the Magisk path directly, they don't need to be mounted to /systemanymore
- Support unload self and modules, leaving no trace for unrelated processes (requires module changes)
- Support remove self and modules from dl_iterate_phdr
- /data/adb/riru/modulesis no longer used, you can remove it when all modules are updated to Riru API 24+
25.3.2 changes
- New way to get realpath on old systems
- Fix next offset on Android 9
v23.9
- Fix crash when JVM reuses reference index on devices with libnativehelper_lazy(libnativehelper_lazymay come in Android 12 DP2 or later) (by LSPosed devs)
v23.8
- Fix a problem that only exists on 32-bit devices