How to Detect Root using Kotlin
Need to secure your app against rooted devices? Start here.
As a developer facing the challenge of root detection, you’ve landed exactly where you need to be—we’ll break down your options and help you make the right choice. Written by experts who’ve built and battled this themselves 😎.

What is rooting?
Rooting is the process of gaining privileged (root or superuser) access to an Android device. Rooting bypasses the application sandbox model, allowing users—and attackers—to access and modify system-level files and settings.
Think of rooting as “administrator access” on a Linux-based OS (which Android is). Common rooting tools include Magisk, SuperSU, Shamiko, KingoRoot and much more.
And how common is root access? 0.03% of devices are rooted — a significant number that could pose security risks

Check out our live global stats at my.talsec.app
While rooting can enable customizations (e.g. removing bloatware, customizing ROMs, running system-level scripts), with that power comes a huge attack surface. It introduces security vulnerabilities—like the ability to hook and inject the code using tools like Frida or Xposed.
How to detect rooted device?
Detecting root on Android is complex and constantly evolving, especially with tools like Magisk. While building your own solution offers control, it’s not recommended due to the time, effort, and expertise required to keep up. Instead, using third-party libraries like freeRASP or RootBeer provides a reliable and up-to-date solution maintained by experts.
Popular Libraries: freeRASP, RootBeer, Play Integrity
Let's compare the most popular options. It's immediately clear why freeRASP is so popular—with a staggering 6,000+ apps using it as of July 2025.
👑 freeRASP (free library by Talsec)
Very strong root detector — detects Magisk 29 and Shamiko
Actively maintained (changelog)
Comes with 14 extra detections like app integrity, Frida and hooking, emulators, debugging, screenshots, etc.
Used by 6000+ apps; #1 Mobile RASP SDK by popularity (link)
Integration guide: https://docs.talsec.app/freerasp
// Start detection (asynchronously)
Talsec.start(...)
override fun onRootDetected() {
Log.w("freeRASP", "Device is rooted!")
// Take action if needed
}
🍺 RootBeer (open-source library by Scott Alexander-Bown)
Open-source root detection tool.
Fully offline checks (no internet dependency).
Lacks detection of the latest techniques.
Used by 5000+ apps
Integration guide: https://github.com/scottyab/rootbeer
// Perform detections (blocking)
val rootBeer = RootBeer(...)
if (rootBeer.isRooted) {
Log.w("RootBeer", "Device is rooted!")
// Take action if needed
}
📡 Play Integrity (library by Google)
Offers strong and officially supported integrity checks.
Requires Google Play Services and backend integration.
Dependent on internet connectivity.
Integration guide: https://developer.android.com/google/play/integrity/setup
Comparison Table
Root Detection Accuracy
High
Medium
❌ Indirect (via signals)
Trusted by
6000+ apps
5000+ apps
N/A
Works Offline
✅
✅
❌ (requires Google Play + Backend)
Detection Response
Listener-based
Manual check
Backend-dependent, server-based validation
Covers Magisk/Hidden Root
✅
❌
❌ (Indirect)
Easy Integration
✅
✅
Moderate (needs server)
Additional Threats Detected
Emulator, Tamper, Debug, Install Source
Root only
Account
Community & Support
Active
Declining
Classic Google — no support whatsoever.
Integration
In-app SDK
In-app SDK
In-app SDK + Backend-dependent, Google-only
You can find detailed description about root and jailbreak detection in our glossary and articles:
Last updated
Was this helpful?