Skip to content

Android 16 KB page-size incompatibility: librive_text.so built with 4 KB LOAD section alignment #527

@khushalt10

Description

@khushalt10

On Android builds using NDK r27+, the prebuilt librive_text.so shipped with the rive Flutter package is not aligned for 16 KB page sizes. APK Analyzer reports: “4 KB LOAD section alignment, but 16 KB is required.” This prevents full compatibility with devices that require 16 KB pages.

Environment
Flutter: stable (≥ 3.22)
rive (Flutter): 0.13.20
Android Gradle Plugin: recent (compatible with compileSdk 36)
compileSdk: 36
targetSdk: 35
minSdk: 28
NDK: r27 27.0.12077973
ABIs tested: armeabi-v7a, arm64-v8a, x86, x86_64

Evidence
APK Analyzer → lib//librive_text.so: “4 KB LOAD section alignment, but 16 KB is required”
Other native libs (e.g., libflutter.so) are 16 KB–aligned on the same build.
Reproduction steps
Use rive: ^0.13.20 in pubspec.yaml.
Build Android release with NDK r27+:
flutter clean
flutter build apk --release
Open the APK in Android Studio’s APK Analyzer.
Navigate to lib//librive_text.so → observe 4 KB LOAD section alignment.

Build configuration (for reference)

android {
  compileSdk = 36
  ndkVersion = "27.0.12077973"

  defaultConfig {
    targetSdk = 35
    // Also tried passing flexible page size flags to native builds:
    externalNativeBuild {
      ndkBuild {
        arguments "APP_LDFLAGS+=-Wl,-z,max-page-size=16384"
      }
      // For CMake builds (not used here):
      // cmake { arguments "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" }
    }
  }
}

Note: These flags only affect code compiled in the app; they cannot modify prebuilt third‑party .so files.

Expected behavior
librive_text.so should be built with 16 KB page-size support (flexible page sizes) so APK Analyzer shows 16 KB LOAD section alignment on all ABIs.

Actual behavior
librive_text.so shows 4 KB LOAD section alignment across ABIs (e.g., arm64-v8a, x86_64), triggering the Android Studio warning “16 KB is required.”

Impact
Potential incompatibility on devices/emulators that require 16 KB pages (Android 15+ guidance).
Blocks shipping without warnings and risks runtime failures on affected devices.
Workarounds tried
Upgraded to NDK r27 and passed -Wl,-z,max-page-size=16384 / -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON where applicable → no effect (prebuilt .so).
Considered removing Rive or replacing with Lottie/static assets as a temporary mitigation.
Request
Please publish rive Flutter artifacts where librive_text.so is built using NDK r27+ with flexible page-size support enabled, producing 16 KB–aligned LOAD sections across all supported ABIs. If a beta or nightly build already includes this, guidance on the version tag would be appreciated.
Attachments you can add

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions