Skip to content

Conversation

@modbender
Copy link
Contributor

Summary

This PR fixes Android build and runtime issues on modern devices (Android 15+) with 16KB page sizes.

Changes

16KB Page Alignment Support

  • Added -Wl,-z,max-page-size=16384 and -Wl,-z,common-page-size=16384 linker flags to CMakeLists.txt
  • Required for devices running Android 15+ with 16KB memory page configuration

LiteRT Upgrade (1.0.1 → 1.4.0)

  • Upgraded all LiteRT dependencies to 1.4.0
  • Fixed header extraction in build.gradle to handle new AAR structure
  • Updated include paths from tensorflow/lite/c/ to tflite/c/ to match new library structure

SDK/NDK Updates

  • minSdkVersion: 21 → 26
  • targetSdkVersion: 31 → 36
  • compileSdkVersion: 31 → 36
  • NDK version: 21.4.7075529 → 27.1.12297006
  • Kotlin version: 1.7.0 → 2.1.10

Testing

Tested on:

  • Physical device with 16KB page size (Pixel 9 Pro with Android 15)
  • Expo managed workflow with EAS Build

Related Issues

Fixes crashes on Android 15 devices with error:

dlopen failed: "/data/app/.../libTflite.so" has p_align 4096 which is not compatible with page size 16384

- Add 16KB page alignment linker flags for Android 15+ support
- Upgrade LiteRT from 1.0.1 to 1.4.0
- Fix header extraction to handle new AAR structure
- Update include paths from tensorflow/lite/ to tflite/
- Bump minSdkVersion to 26, targetSdkVersion to 36
- Update NDK version to 27.1.12297006

This fixes build and runtime issues on devices with 16KB page sizes.
@mrousavy mrousavy merged commit 2959de9 into mrousavy:main Jan 12, 2026
4 of 5 checks passed
@juv85
Copy link

juv85 commented Jan 12, 2026

Thank you, looking forward to test this out 🙏

@modbender
Copy link
Contributor Author

modbender commented Jan 12, 2026

I built APK and analyzed it on Android Studio APK Debugger it's fine
image

If it was not all 16kb aligned the lib folder would have a warning symbol

@modbender
Copy link
Contributor Author

Now just waiting for the release.

@mrousavy
Copy link
Owner

released 2.0.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants