I *Export*ed from Aurora Store Firefox Android `{config.{arm64_v8a,xxhdpi},base}.apk`. I decompressed `config.arm64_v8a.apk` with `apktool d`, modified a file, recompressed with `apktool b` and aligned with `zipalign -v 4` signed it with `apksigner` with my own key (not initial Firefox Android one). When I try to install on Fairphone 4 LineageOS 23.2 my modified `config.arm64_v8a.apk` I face:
``` 06-07 16:57:07.247 1505 12093 W libbinder.Binder: Binder transaction to android.content.pm.IPackageManager code 1598246212 took 7573ms. Data bytes: 296 Reply bytes: 4 Flags: 16 06-07 16:57:07.250 11651 11651 I abb : StartCommandInProcess(7061636b61676500696e7374616c6c2d package.install- [truncated]) 06-07 16:57:07.278 11651 11651 I abb : StartCommandInProcess(7061636b61676500696e7374616c6c2d package.install- [truncated]) 06-07 16:57:07.956 1505 27482 E NativeLibraryHelper: extractNativeLibs=false library 'libmegazord.so' is not PAGE(4096)-aligned within apk (APK alignment, not ELF alignment) -will not be able to open it directly from apk. 06-07 16:57:07.956 1505 27482 W NativeHelper: Failure copying native libraries [errorCode=-2] 06-07 16:57:07.957 1505 27482 D PackageInstallerSession: Marking session 991097439 as failed: INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2 06-07 16:57:07.957 1505 27482 I PackageInstallerSession: Session [991097439] was destroyed because of [Session marked as failed: INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2] 06-07 16:57:08.005 1505 27482 E PackageInstallerSession: Failed to verify session 991097439 ```
Jun 7, 3:00pm
The error you're encountering, INSTALL_FAILED_INTERNAL_ERROR: Failed to extract native libraries, res=-110 and INSTALL_FAILED_INVALID_APK: Failed to extract native libraries, res=-2, is directly related to the alignment and structure of your modified config.arm64_v8a.apk. The key log line is:
text
E NativeLibraryHelper: extractNativeLibs=false library 'libmegazord.so' is not PAGE(4096)-aligned within apk (APK alignment, not ELF alignment) - will not be able to open it directly from apk.
Root Cause
1. APK Alignment Issue
Android requires all APKs (including split APKs like config.arm64_v8a.apk) to be 4KB (4096-byte) aligned for native libraries (.so files) to be extracted and loaded correctly.
Your zipalign -v 4 command aligns the APK, but if the native libraries inside the APK are not properly aligned or the APK itself is not correctly structured after modification, this error occurs.
The log explicitly states that libmegazord.so is not page-aligned within the APK.
2. Split APK Structure
When using install-multiple, all split APKs must be properly aligned and signed with the same key.
If the base.apk and config.arm64_v8a.apk are not signed with the same key, or if the alignment is broken, the installer will fail.
3. Modification Impact
Modifying files in config.arm64_v8a.apk (especially if it affects the lib/ directory or the APK's internal structure) can break the alignment or the expected layout.
How to Fix
1. Recheck APK Alignment
After rebuilding with apktool b, always run zipalign -v 4 on the output APK.