Skip to content

[Android] libmediapipe_tasks_vision_jni.so & libimage_processing_util_jni.so not 16 KB page-size aligned #664

@roshni-warrantylife

Description

@roshni-warrantylife

Bug Description

The prebuilt .so files bundled with the latest MediaPipe Android release are
not aligned to 16 KB page boundaries, causing failures on Android 15+ devices
that use 16 KB memory page sizes.

Affected Libraries

  • lib/arm64-v8a/libmediapipe_tasks_vision_jni.so — LOAD segment not aligned
  • lib/arm64-v8a/libimage_processing_util_jni.so — LOAD segment not aligned

Error Message

The following libraries are not 16 KB aligned:
- lib/arm64-v8a/libmediapipe_tasks_vision_jni.so: LOAD segment not aligned
- lib/arm64-v8a/libimage_processing_util_jni.so: LOAD segment not aligned

Steps to Reproduce

  1. Create a new Android project
  2. Add MediaPipe Tasks Vision dependency (latest version)
  3. Implement Object Detector using MediaPipe
  4. Build and upload to Play Console OR run on Android 15 16 KB page-size emulator
  5. Observe 16 KB alignment warning/error

Environment

  • MediaPipe Version: 0.20230731 (latest)
  • Android Gradle Plugin: 8.9.3
  • Target SDK: 35 (Android 15)
  • Affected ABI: arm64-v8a
  • Task used: Object Detector (tasks-vision)

Expected Behavior

All prebuilt .so files should be compiled and linked with 16 KB alignment
to support Android 15+ devices, as per Google's own requirement:
https://developer.android.com/guide/practices/page-sizes

Actual Behavior

The prebuilt .so files are only 4 KB aligned, causing the 16 KB page-size
alignment error in the 16 KB page-size enabled devices.

Workaround (Temporary - Not working either)

Adding the following to build.gradle reduces the error in some cases but
does not fully resolve it since the issue is in the prebuilt binaries:

android {
    packagingOptions {
        jniLibs {
            useLegacyPackaging = false
        }
    }
}

References

Request

Please recompile and release MediaPipe prebuilt .so files with 16 KB
alignment support so apps using MediaPipe can comply with Android 15+
requirements without manual workarounds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions