android_16kb_patcher 1.0.2
android_16kb_patcher: ^1.0.2 copied to clipboard
A CLI tool to patch Android native libraries (.so) to 16KB page size alignment, ensuring compatibility with Android 15 and Google Play requirements.
Android 16KB Patcher #
A simple, fast, and automated Dart CLI tool to permanently patch Android native libraries (.so files) from 4KB to 16KB memory page alignment.
This tool acts as a lifesaver for developers encountering Google Play's strict 16 KB memory page sizes requirement (enforced for Android 15+) who rely on legacy third-party vendor SDKs or precompiled .so files that cannot be easily updated.
The Problem #
Google Play now mandates that all native libraries must be aligned to 16KB. If your app includes old hardware SDKs (like RFID scanners, thermal printers, etc.) that were compiled with 4KB alignment (align 2**12), the Play Store will reject your APK/AAB, and it will crash on real Android 15 devices.
The Solution #
This tool physically patches the ELF headers (PT_LOAD segments) of your .so files in place, forcing them into a 16KB alignment (align 2**14) without breaking the internal C++ logic.
Installation #
Add it as a dev dependency in your pubspec.yaml:
dev_dependencies:
android_16kb_patcher: ^1.0.0
Usage #
Simply run the tool from your Flutter project root:
dart run android_16kb_patcher
By default, the script will automatically scan and patch all .so files located inside android/app/src/main/jniLibs.
If your .so files are in a different directory, you can specify the path:
dart run android_16kb_patcher path/to/your/custom_folder
Important Follow-up Step #
To ensure the Android OS does not try to extract and compress the libraries incorrectly, ensure your AndroidManifest.xml includes android:extractNativeLibs="true" inside the <application> tag.
Acknowledgements #
Inspired by the Python implementation from the community (syafiyft), rewritten entirely in Dart for seamless integration into Flutter developer workflows without requiring Python.