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

Crash on Android 15 (SDK 35) with 16KB page alignment: libpdfiumandroid.so fails to load due to missing hash section

Open abitling opened this issue 6 months ago • 36 comments

When using react-native-pdf v6.7.7 on a device running Android 15 (SDK 35) with 16KB page alignment, the app crashes upon mounting the <Pdf /> component. The crash is due to a native library loading failure:

java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/.../libpdfiumandroid.so" (new hash type from the future?)

Complete Stack Trace :

Native libraries failed to load
	java.lang.UnsatisfiedLinkError: dlopen failed: empty/missing DT_HASH/DT_GNU_HASH in "/data/app/.../libpdfiumandroid.so" (new hash type from the future?)
		at java.lang.Runtime.loadLibrary0(Runtime.java:1081)
		at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
		at java.lang.System.loadLibrary(System.java:1765)
		at io.legere.pdfiumandroid.PdfiumCore._init_$lambda$28(PdfiumCore.kt:534)
		at io.legere.pdfiumandroid.PdfiumCore.$r8$lambda$XuqcpolvQXrnr4u5D9FnuN1EJQY(Unknown Source:0)
		at io.legere.pdfiumandroid.PdfiumCore$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
		at java.lang.Thread.run(Thread.java:1012)

Environment :

  • react-native: 0.79.2
  • react-native-pdf: 6.7.7
  • Node: v24.2.0
  • npm: v11.3.0
  • buildToolsVersion: 35.0.0
  • minSdkVersion: 24
  • compileSdkVersion: 35
  • targetSdkVersion: 35
  • ndkVersion: 27.1.12297006
  • kotlinVersion: 2.0.21
  • Device: Android 15 emulator with 16KB memory page size (required for Google Play compliance as of mid-2025)
  • Crash occurs consistently when <Pdf /> component is mounted

Possible Cause : The issue seems related to libpdfiumandroid.so not being built correctly for 16KB page size devices, leading to a missing or invalid dynamic hash section (DT_HASH/DT_GNU_HASH). This may stem from misaligned native libraries or build tool incompatibilities with Android 15+.

What I've Tried :

  • Using latest NDK and build tools
  • Works fine on older Android versions (< SDK 34)

Suggested Action : Please confirm if the bundled libpdfiumandroid.so supports 16KB page alignment and is compatible with Android 15 (SDK 35). If not, guidance or fixes to rebuild it with proper section headers and alignment would be greatly appreciated.

abitling avatar Jun 24 '25 07:06 abitling