Overview
The vast majority of Android system services, core providers, and third-party applications store structured persistent state in SQLite databases (.db files in /data/data/<package>/databases/). From telephony call logs and SMS archives to Wi-Fi credentials and app preferences, inspecting or repairing these records is a fundamental task for system administrators, security auditors, and automation script authors.
However, Google stripped the standalone sqlite3 CLI executable from production Android system images years ago. Developers attempting to run database queries via ADB or Termux are met with sqlite3: inaccessible or not found.
Developed by Rojen Zaman, SQLite3 for Android is a lightweight systemless module that reinstates an optimized, statically linked sqlite3 binary across arm64-v8a, armeabi-v7a, x86, and x86_64 devices.
Multi-Architecture Compatibility
Unlike basic binary dumps pulled from development emulator images, this module uses static compilation scripts maintained by Jacopo Tediosi. Because the binary is fully stripped and statically linked against standard C runtimes, it does not suffer from dynamic linker symbol errors on older or non-standard Android releases.
Verified Hardware & Virtual Environments:
- arm64-v8a: Physical smartphones and tablets (tested on Lenovo Tab M10 Plus Gen 3, Xiaomi Mi 6, Samsung Galaxy S6 Edge).
- armeabi-v7a: Legacy 32-bit ARM handsets.
- x86 / x86_64: Android emulation platforms, virtual machines, and containerized environments (tested on Waydroid on Linux and LDPlayer 9 on PC).
Installation & Verification
- Download the
SQLite-for-magisk.multi-arch.zipfrom the GitHub releases page. - Flash the module using Magisk, KernelSU, or APatch.
- The installer automatically detects your CPU architecture and symlinks the corresponding binary into
/system/xbin/sqlite3.
- The installer automatically detects your CPU architecture and symlinks the corresponding binary into
- Reboot your device.
- Launch Termux or open an
adb shell, acquire root privileges, and verify execution:
The command should return the compiled SQLite version number.su -c sqlite3 --version
Common Database Administration Commands
Once installed, you can query and modify Android databases directly from the command line:
Querying System Settings
# Query global Android system settings table
su -c sqlite3 /data/system/users/0/settings_global.db "SELECT name, value FROM global WHERE name LIKE '%adb%';"
Inspecting Application Databases
# Open an interactive SQLite session with an app database
su -c sqlite3 /data/data/com.example.app/databases/app_data.db
# Inside the SQLite prompt:
.tables
.schema user_profiles
SELECT * FROM user_profiles LIMIT 5;
.quit
Running Automated Script Maintenance
# Execute WAL checkpointing and database vacuuming
su -c sqlite3 /data/data/com.example.app/databases/cache.db "PRAGMA wal_checkpoint(TRUNCATE); VACUUM;"
Troubleshooting
- “Permission denied” When Opening Databases: Databases under
/data/data/are protected by SELinux and Unix file permissions. Always executesqlite3within a root shell (su). - Binary Architecture Mismatch: If running on an unconventional emulator and seeing
cannot execute binary file: Exec format error, check your kernel architecture viauname -mand verify that the installer selected the matching binary.
