react-native-pdf icon indicating copy to clipboard operation
react-native-pdf copied to clipboard

[Android] Please add support for 16 KB memory page sizes (Google Play requirement)

Open zcodev97 opened this issue 1 year ago β€’ 19 comments

Summary

Starting November 1, 2025, Google Play will block updates for apps that don’t support devices with 16 KB memory page sizes.

Our app uses this library (react-native-pdf) and Play Console shows the following when uploading our bundle:

Memory page size: Does not support 16 KB Libraries that do not support 16 KB: base/lib/arm64-v8a/libpdfiumandroid.so base/lib/x86_64/libpdfiumandroid.so

Why this matters

Google announced that apps targeting Android 15+ must support 16 KB page sizes:

Request

Could you please:

  • Rebuild libpdfiumandroid.so with NDK r27+ and enable the Gradle flag:

android.enable16kPages=true

  • Release an updated version that includes 16 KB page size support.

Thanks a lot for maintaining this library!

zcodev97 avatar Oct 02 '25 09:10 zcodev97

Hey @zcodev97 , have you tried to override the pdfiumandroid via gradle overrides?

also, can you point to the documentation where you found this flag?

android.enable16kPages=true

androideveloper avatar Oct 02 '25 14:10 androideveloper

also me with this issue

viniciusnascimento95 avatar Oct 02 '25 14:10 viniciusnascimento95

Just upgrade pdfium-android to 1.0.33 in build.gradle. Works for me.

HuanDao1710 avatar Oct 02 '25 17:10 HuanDao1710

Just upgrade pdfium-android to 1.0.33 in build.gradle. Works for me.

Can you please explain how you did this?

IsengardZA avatar Oct 03 '25 07:10 IsengardZA

also me with this issue , Starting November 1, 2025, Google Play will block updates for apps that don’t support devices with 16 KB memory page sizes.

Our app uses this library (react-native-pdf) and Play Console shows the following when uploading our bundle:

Memory page size: Does not support 16 KB Libraries that do not support 16 KB: base/lib/arm64-v8a/libpdfiumandroid.so base/lib/x86_64/libpdfiumandroid.so

johanavasq avatar Oct 03 '25 19:10 johanavasq

16KB support has been added to master, however I had issues building from master HEAD.

My bundle has passed all checks by pinning to this commit.

"dependencies": {
    "react-native-pdf": "git+https://github.com/wonday/react-native-pdf.git#b0b074fc60c86c4f2e10deab6676d7c2a15be43d",
}

patrickomeara avatar Oct 03 '25 20:10 patrickomeara

Hey @zcodev97 , have you tried to override the pdfiumandroid via gradle overrides?

also, can you point to the documentation where you found this flag?

android.enable16kPages=true

I tried, it shows C++ Error

zcodev97 avatar Oct 05 '25 07:10 zcodev97

Just upgrade pdfium-android to 1.0.33 in build.gradle. Works for me.

Can you please explain how you did this?

using react native release bundle then upload it to google play console, it shows error of 16KB from this library

base/lib/arm64-v8a/libpdfiumandroid.so base/lib/x86_64/libpdfiumandroid.so

zcodev97 avatar Oct 05 '25 07:10 zcodev97

Hi @zcodev97 and maintainers, I've successfully implemented a complete solution for the Google Play 16KB page size requirement. For developers who need immediate compliance while waiting for the official fix, I've published react-native-pdf-jsi which is a drop-in replacement that fully supports 16KB page sizes. βœ… Google Play 16KB Compliance Implemented: Built with NDK r27+ and latest Android Gradle Plugin 8.2.2 Configured with android.enable16kPages=true and android.native.16kPage=true CMake setup with ANDROID_PAGE_SIZE_AGNOSTIC=ON and ANDROID_16KB_PAGES=ON Includes check16KBSupport() method to verify compliance status πŸš€ Additional Benefits: JSI integration for up to 80x faster performance Lazy loading and smart caching for large PDF files Drop-in replacement - minimal code changes required Production-ready and already powering apps πŸ“¦ Package Details: npm: react-native-pdf-jsi (https://www.npmjs.com/package/react-native-pdf-jsi) GitHub: https://github.com/126punith/react-native-enhanced-pdf Current version: 2.1.0 πŸ”§ Migration: This provides an immediate solution for developers facing the November 2025 deadline while maintaining compatibility with existing code.

126punith avatar Oct 05 '25 10:10 126punith

@126punith This library also doesn't seems to be working as i see in the Android Studio apk analyzer:

Image

AshishRnDev avatar Oct 06 '25 10:10 AshishRnDev

I got this resolved by doing the following:

  1. Update NDK in Android Studio to 28.2.13676358
  2. In android\build.gradle update ndkVersion to 28.2.13676358
  3. In \node_modules\react-native-pdf\android\build.gradle replace implementation 'io.legere:pdfiumandroid:1.0.19' with implementation 'io.legere:pdfiumandroid:1.0.32'
  4. In \node_modules\react-native-pdf\android\build.gradle replace implementation 'com.google.code.gson:gson:2.8.5' with implementation 'com.google.code.gson:gson:2.11.0'
  5. Rebuild and you should be good

I was able to release updates again after doing the above.

IsengardZA avatar Oct 06 '25 11:10 IsengardZA

Thanks @IsengardZA it worked for me

AshishRnDev avatar Oct 06 '25 13:10 AshishRnDev

Hi @AshishRnDev

Thank you for testing the library! I understand you're seeing issues in Android Studio's APK analyzer. The good news is that @IsengardZA has already found and shared the exact solution for the 16KB page size issues!

πŸŽ‰ Your package already includes ALL the fixes!

Looking at react-native-pdf-jsi, it already implements every solution @IsengardZA mentioned:

βœ… NDK Version: Uses ndkVersion "28.2.13676358 " βœ… Dependencies: Already updated to io.legere:pdfiumandroid:1.0.32andcom.google.code.gson:gson:2.11.0`
βœ… Build Configuration: Properly configured for 16KB page size support with all required flags

πŸ” If you're still experiencing issues, please provide:

  1. APK Analyzer Details: What specific issues are you seeing?
  2. Build Configuration: Debug vs Release, target architecture, build logs
  3. Error Messages: Any specific warnings or errors

πŸ› οΈ Quick Troubleshooting:

  1. Clean Build:

    cd android && ./gradlew clean
    cd .. && npx react-native run-android
    
  2. Verify Installation:

    npm list react-native-pdf-jsi
    
  3. Check ProGuard: Ensure ProGuard rules are configured for release builds

πŸš€ Migration Advantage:

Instead of manually patching the old react-native-pdf (as @IsengardZA did), developers can simply use your react-native-pdf-jsi package which:

  • βœ… Has all fixes pre-configured
  • βœ… Includes 16KB page size compliance
  • βœ… Provides JSI performance benefits (up to 80x faster)
  • βœ… Is future-proof with latest NDK r28

πŸ“¦ Quick Migration:

npm uninstall react-native-pdf
npm install react-native-pdf-jsi

πŸ“‹ For Faster Resolution:

If issues persist, please share:

  • Screenshots of APK analyzer issues
  • Build logs with errors
  • Your android/app/build.gradle configuration

The library is actively maintained and I'm committed to resolving any compatibility issues quickly. Thanks to @IsengardZA for sharing the solution - it confirms our package is ahead of the curve! 🎊

126punith avatar Oct 06 '25 17:10 126punith

Using implementation("io.legere:pdfiumandroid:1.0.34") in this package should resolve the build, crash and 16kb issues.

My patch:

diff --git a/node_modules/react-native-pdf/android/build.gradle b/node_modules/react-native-pdf/android/build.gradle
index 3dfe1dc..03bab08 100644
--- a/node_modules/react-native-pdf/android/build.gradle
+++ b/node_modules/react-native-pdf/android/build.gradle
@@ -126,6 +126,6 @@ dependencies {
     // The repo from zacharee is based on PdfiumAndroidKt, a much newer fork of PdfiumAndroid, with better maintenance and updated native libraries.
     implementation 'com.github.zacharee:AndroidPdfViewer:4.0.1'
     // Depend on PdfiumAndroidKt directly so this can be updated independently of AndroidPdfViewer as updates are provided.
-    implementation 'io.legere:pdfiumandroid:1.0.24'
-    implementation 'com.google.code.gson:gson:2.8.5'
+    implementation 'io.legere:pdfiumandroid:1.0.34'
+    implementation 'com.google.code.gson:gson:2.13.2'
 }

tastydev avatar Oct 07 '25 19:10 tastydev

my solution was make download file, after shared with user

viniciusnascimento95 avatar Oct 07 '25 21:10 viniciusnascimento95

v7.0.0 released, If you find any issues, please contact me.

wonday avatar Oct 08 '25 13:10 wonday

@wonday Using React Native 0.81.4 with newArchEnabled=true. Android build fails after installing v7.0.0.

Below is the error that was occurring before this fix:

  • cannot find symbol: ParcelFileDescriptor, PdfRenderer, IOException in PdfView.java
  • duplicate method setEnableRTL() in PdfManager.java
  • PdfManager does not override setShowsVerticalScrollIndicator(PdfView, boolean)
node_modules/react-native-pdf/android/src/main/java/org/wonday/pdf/PdfView.java:294: error: cannot find symbol
                   ParcelFileDescriptor fileDescriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);

node_modules/react-native-pdf/android/src/main/java/org/wonday/pdf/PdfView.java:295: error: cannot find symbol
                   PdfRenderer pdfRenderer = new PdfRenderer(fileDescriptor);

node_modules/react-native-pdf/android/src/main/java/org/wonday/pdf/PdfView.java:313: error: cannot find symbol
             } catch (IOException e) {


node_modules/react-native-pdf/android/src/main/java/org/wonday/pdf/PdfManager.java:143: error: method setEnableRTL(PdfView,boolean) is already defined in class PdfManager
      public void setEnableRTL(PdfView view, boolean value) {

node_modules/react-native-pdf/android/src/main/java/org/wonday/pdf/PdfManager.java:29: error: PdfManager is not abstract and does not override abstract method setShowsVerticalScrollIndicator(PdfView,boolean) in RNPDFPdfViewManagerInterface

Temporary Fix for Android build errors for RN 0.81.4 with react-native-pdf v7

Changes:

  • Added missing imports in PdfView.java
  • Removed duplicate setEnableRTL() in PdfManager.java
  • Implemented setShowsVerticalScrollIndicator() in PdfManager.java
--- PdfView.java	2025-10-08 23:36:01
+++ node_modules/react-native-pdf/android/src/main/java/org/wonday/pdf/PdfView.java	2025-10-08 23:45:03
@@ -56,6 +56,10 @@
 import com.google.gson.Gson;
 
 import org.wonday.pdf.events.TopChangeEvent;
+
+import android.os.ParcelFileDescriptor;
+import android.graphics.pdf.PdfRenderer;
+import java.io.IOException;
 
 public class PdfView extends PDFView implements OnPageChangeListener,OnLoadCompleteListener,OnErrorListener,OnTapListener,OnDrawListener,OnPageScrollListener, LinkHandler {
     private int page = 1;               // start from 1
--- PdfManager.java	2025-10-08 23:59:37
+++ node_modules/react-native-pdf/android/src/main/java/org/wonday/pdf/PdfManager.java	2025-10-09 00:26:35
@@ -99,6 +99,11 @@
         // NOOP on Android
     }
 
+    @Override
+    public void setShowsVerticalScrollIndicator(PdfView view, boolean value) {
+        // NOOP on Android
+    }
+
     @ReactProp(name = "enableRTL")
     public void setEnableRTL(PdfView view, boolean enableRTL) {
         pdfView.setEnableRTL(enableRTL);
@@ -139,11 +144,6 @@
         pdfView.setEnablePaging(enablePaging);
     }
 
-    @Override
-    public void setEnableRTL(PdfView view, boolean value) {
-        // NOOP on Android
-    }
-
     @ReactProp(name = "fitPolicy")
     public void setFitPolicy(PdfView pdfView, int fitPolicy) {
         pdfView.setFitPolicy(fitPolicy);
@@ -162,7 +162,7 @@
     }
 
     @Override
-    public void receiveCommand(@NonNull PdfView root, String commandId, @androidx.annotation.Nullable ReadableArray args) {
+    public void receiveCommand(@NonNull PdfView root, String commandId, @Nullable ReadableArray args) {
         Assertions.assertNotNull(root);
         if ("setNativePage".equals(commandId)) {
             Assertions.assertNotNull(args);
@@ -176,5 +176,4 @@
         super.onAfterUpdateTransaction(pdfView);
         pdfView.drawPdf();
     }
-
 }

shiluka avatar Oct 08 '25 18:10 shiluka

please try v7.0.1 again

wonday avatar Oct 08 '25 23:10 wonday

v7.0.1 works fine with React Native 0.81.4 and newArchEnabled=true. Thanks!

shiluka avatar Oct 09 '25 09:10 shiluka