Hi all.
I have a question. Since the PDFium library is a only option to open a PDF and this lib is not 16KB compatible - are there any option to update this lib?
I tried to update the Pdfium.aar according to https://www.b4x.com/android/forum/t...ot-support-16kb-alignment.168440/post-1032482
I downloaded PdfiumAndroid-2.0.0-release.aar from https://github.com/chiragthummar/PdfiumAndroid16KB/blob/master/aar/PdfiumAndroid-2.0.0-release.aar, opened with 7zip and replaced .so files in Pdfium.aar with so files from PdfiumAndroid-2.0.0-release.aar.
Then I compiled a project in Release mode and tried to check the apk with this script https://www.b4x.com/android/forum/threads/script-to-check-compatibility-16kb.168429/
So far so good.
Then I checked the apk with the chatgpt and the chat says that even though the script shows that the apk is Ok it doesn't.
That's what the chatGPT says
I checked every native library in:
PDFiumEx.apk → lib/arm64-v8a/
and NONE of the .so files meet the Android 16 KB page-size requirement.
For each LOAD segment, the alignment must be:
0x4000 = 16384 bytes = 16 KB
Your libraries have alignments like:
Not a single one has Align 0x4000, so Google Play will reject this APK when targeting API 34+ devices with 16 KB page size.
The problematic libraries all originate from PDFium / modpdfium / modpng stack — this library set was built with older NDK toolchains that did not support 16 KB page sizes.
This APK cannot be published on Google Play for devices with 16 KB memory pages (Samsung S24, Pixel 9, etc.) without rebuilding these libs.
Rebuild every native library using:
NDK r26b or newer
and pass linker flags:
-Wl,-z,max-page-size=16384
-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON
Example for CMake:
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
For PDFium specifically, you need a recent build — the older static libraries are not compatible.
I have a question. Since the PDFium library is a only option to open a PDF and this lib is not 16KB compatible - are there any option to update this lib?
I tried to update the Pdfium.aar according to https://www.b4x.com/android/forum/t...ot-support-16kb-alignment.168440/post-1032482
I downloaded PdfiumAndroid-2.0.0-release.aar from https://github.com/chiragthummar/PdfiumAndroid16KB/blob/master/aar/PdfiumAndroid-2.0.0-release.aar, opened with 7zip and replaced .so files in Pdfium.aar with so files from PdfiumAndroid-2.0.0-release.aar.
Then I compiled a project in Release mode and tried to check the apk with this script https://www.b4x.com/android/forum/threads/script-to-check-compatibility-16kb.168429/
So far so good.
Then I checked the apk with the chatgpt and the chat says that even though the script shows that the apk is Ok it doesn't.
That's what the chatGPT says
This APK is NOT 16-KB compatible
I checked every native library in:
PDFiumEx.apk → lib/arm64-v8a/
and NONE of the .so files meet the Android 16 KB page-size requirement.
Why?
For each LOAD segment, the alignment must be:
0x4000 = 16384 bytes = 16 KB
Your libraries have alignments like:
| Library | Alignment found | Required |
|---|---|---|
| libc++_shared.so | 0x00000000000d35c8 | |
| libjniPdfium.so | 0x000000000001e8c0 | |
| libmodft2.so | 0x00000000000b50e0 | |
| libmodpdfium.so | 0x00000000004a3968 | |
| libmodpng.so | 0x000000000003f450 |
Not a single one has Align 0x4000, so Google Play will reject this APK when targeting API 34+ devices with 16 KB page size.
Most critical offenders
The problematic libraries all originate from PDFium / modpdfium / modpng stack — this library set was built with older NDK toolchains that did not support 16 KB page sizes.
What this means
This APK cannot be published on Google Play for devices with 16 KB memory pages (Samsung S24, Pixel 9, etc.) without rebuilding these libs.
🛠 How to fix it
Rebuild every native library using:
NDK r26b or newer
and pass linker flags:
-Wl,-z,max-page-size=16384
-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON
Example for CMake:
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
For PDFium specifically, you need a recent build — the older static libraries are not compatible.