If youโve ever looked into your Xiaomi smartphoneโs system files or analyzed logs through ADB, youโve probably come across the term Android Shared Library (or.so files for short), which is the basis for most apps and services on Android devices, but remains a black box for ordinary users, while understanding shared libraries helps diagnose bugs, optimize performance, and even solve software compatibility problems.
In this article, we will explore in detail what a shared library is in the context of Xiaomi smartphones, how it interacts with MIUI firmware, and why some users experience errors like lib*.so not found or unsatisfied link error. We will also look at practical scenarios โ from manually updating libraries to restoring their integrity after unsuccessful manipulation of the system. If you have ever seen in the logs mentions of libmiui.so, libxmvirt.so or libarcore.so โ this material will help to understand their role and possible problems.
What is Android Shared Library and Why You Need It?
In the Android operating system, a shared library is a compiled binary file with the.so extension (from shared object) that contains reusable code. These libraries allow multiple applications or system components to share the same set of functions without duplicating it in each. APK-For example, the libc.so library (the C standard library) is used by almost all processes in the system.
On Xiaomi smartphones, shared libraries play a particularly important role due to two factors:
- ๐ฑ MIUI-Optimization: Firmware MIUI actively uses its own libraries (for example, libmiui.so) to implement branded functions - from animations to energy saving.
- ๐ Architectural differences: Xiaomi releases devices on different processor architectures (ARMv7, ARMv8, x86 in rare cases), and libraries are compiled separately for each of them.
- ๐ ๏ธ Modular structure: Many functions (e.g. image processing through the use of a libjni_latinimegoogle.so) Removed to separate libraries for flexibility.
Without shared libraries, applications would grow by many times, and system updates would take up much more space. libandroid_runtime.so, Java code interfaces with native components, used by thousands of applications simultaneously.
Where are shared libraries stored on Xiaomi and how to find them?
Shared libraries on Xiaomi are distributed across multiple system folders, access to which requires root rights or ADB use.
- ๐ /system/lib/ โ standard libraries 32-bit applications (e.g. libc.so, libm.so).
- ๐ /system/lib64/ โ 64-bit versions of libraries (used on modern devices with ARMv8).
- ๐ /vendor/lib/ โ hardware platform-specific libraries (e.g., Qualcomm or Mediatek chip drivers).
- ๐ /data/app-lib/ โ libraries installed with applications (new versions of Android moved to the /data/app/...).
To view the list of libraries on your device, you can use the command:
adb shell ls /system/lib/ | grep ".so"Or for 64-bit:
adb shell ls /system/lib64/ | grep ".so"For example, on the Xiaomi Redmi Note 10 Pro (sweet) in the /vendor/lib64/ folder, you can find libraries like libqti-perfd-client.so (responsible for the performance of the Snapdragon 732G chipset) or libwvhidl.so (for working with Widevine DRM).
๐ก
If you are looking for a specific library, use the adb shell find command / -name "lib*.so" 2>/dev/null - this recursively scans all folders, ignoring access errors.
Common problems with shared library on Xiaomi and their causes
Xiaomi users often experience shared library errors, and here are the most common scenarios:
| Mistake. | Reason. | Typical devices |
|---|---|---|
| java.lang.UnsatisfiedLinkError: lib*.so not found | Library deleted, damaged or incompatible with version Android/architecture. | Poco X3, Redmi 9 (after root-hacking) |
| dlopen failed: library "libmiui.so" not found | Damage to MIUI system files (often after a failed update) | Mi 11, Mi 10T. |
| The application will fly out at launch without logs. | Libraries conflict (e.g. libarcore.so for ARCore). | Poco F3, Redmi K40. |
| Symbol not found in the logs. | The library is built under a different version of the NDK (Native Development Kit). | Xiaomi 12 (after downgrade firmware). |
Most often, problems arise after:
- ๐ Updates/downgrade firmware (for example, with MIUI 13 on MIUI 12.5).
- ๐ง Root access or modification of system files (libxmvirt.so, which is responsible for virtualization in the system) MIUI).
- ๐ฑ Install custom firmware (for example, LineageOS without proprietary libraries Xiaomi).
Why are library errors more common on Xiaomi than on pure Android?
How to diagnose problems with shared library
If an application or system component has stopped working, the first thing to do is check the logs for errors related to libraries.
- Get logs via ADB: adb logcat | grep -i "lib" This will display all references to libraries in logs. Look for lines with dlopen failed or UnsatisfiedLinkError.
- Check the library availability: adb shell ls -l /system/lib*/libNAME Libraries.so Replace the name Libraries with the name from the log (e.g. libmiui).
- Learn the architecture of the device: adb shell getprop ro.product.cpu.abi This will help you understand which version of the library (arm, arm64, x86) you need to look for.
Example of inference in a problem:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 1234
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.app-1/lib/arm64, /system/lib64, /vendor/lib64]]] couldn't find "libcustom.so"In this case, the application looks for libcustom.so in the /data/app/.../lib/arm64, /system/lib64, and /vendor/lib64 folders, but does not find it.
โ๏ธ Diagnosing Libraries Problems
How to restore or update a shared library in Xiaomi
If you find that the problem is due to the lack or damage to the library, there are several ways to restore it:
1. Recovery via Fastboot (official method)
The most reliable way is to reflash the device with data storage using the official Fastboot-ROM from Xiaomi.
- Download the firmware for your model from the MIUI Downloads website.
- Unpack the archive and launch the script flash_all_except_data.bat (Windows or flash_all_except_data.sh (Linux/macOS).
This will restore all system libraries without affecting user data.
2. Manual copying of libraries (for experienced users)
If you know which library is damaged, you can copy it from another device or backup, for example, to restore libmiui.so:
adb push libmiui.so /sdcard/
adb shell
su
mount -o rw,remount /system
cp /sdcard/libmiui.so /system/lib64/
chmod 644 /system/lib64/libmiui.so
reboot๐ก
Never copy libraries from devices on another architecture (e.g., from ARMv7 to ARMv8), which will lead to system failure.
3. Use of Magisk modules
For some libraries (e.g. libarcore.so for ARCore), there are ready-made modules for Magisk that automatically fix compatibility issues.
- Download the module (for example, ARCore for all devices).
- Install it with Magisk โ Modules โ Install from storage.
- Reset the device.
The advantage of this method is that you do not need root access to the system partition, since the modules are mounted on top of the original files.
Shared Library and Custom Firmware: What You Need to Know
Installing custom firmware (e.g. LineageOS, Pixel Experience) on Xiaomi is often accompanied by problems with proprietary libraries, because many features (camera, modem, DRM) depend on Xiaomiโs closed libraries, which are not included in open builds.
To avoid problems, follow these recommendations:
- ๐ง Use firmware marked "for sweet" (for the Redmi Note 10 Pro) or similar for your model. Universal builds may not contain the right libraries.
- ๐ฆ Set proprietary packages (vendor) separately, for example, for Poco. F1 (Beryllium needs a package vendor_xiaomi_beryllium.
Example of a command to install proprietary files via TWRP:
adb push vendor_xiaomi_sweet.img /sdcard/
twrp install /sdcard/vendor_xiaomi_sweet.imgWhat if the camera does not work after installing the custom firmware?
Optimizing productivity through library setup
Some Xiaomi users are experimenting with replacing standard libraries with optimized versions to improve performance.
- ๐ Replace libskia.so: This library is responsible for rendering graphics. Optimized versions (such as from firmware for Google Pixel) can speed up the interface.
- ๐ฎ Modifications libGLESv2_adreno.so: For Snapdragon devices (e.g. Poco) X3 Pro) there are patches that improve performance in games.
- ๐ Optimization of libpowermanager.so: Affects power consumption, but requires caution โ incorrect settings can lead to overheating.
However, such manipulations are fraught with risks:
โ ๏ธ Warning: Replacing system libraries without a backup can result in bootloop ( looped boot) or inoperability of key features (such as mobile network). TWRP before experimentation!
Example of a backup folder with libraries:
adb shell
su
tar -cvzf /sdcard/lib_backup.tar.gz /system/lib64/ /vendor/lib64/