Skip to content

Make OpenCV dependency 16 KB page-size compatible before Google Play’s May 31, 2026 enforcement #28

@xOctave

Description

@xOctave

Description

When using capacitor-document-scanner on Android, the app includes OpenCV native libraries (e.g. libopencv_java4.so) via the plugin’s dependency on com.websitebeaver:documentscanner, which itself depends on com.websitebeaver:opencv (currently 4.1.0). Those prebuilts aren’t aligned for 16 KB page sizes, so the app fails Play requirements and/or won’t run on 16 KB devices/emulators.

Google has added support for 16 KB memory page sizes in Android 15 and is enforcing compatibility on Google Play. Any app that ships NDK libraries—directly or indirectly via SDKs—must be rebuilt/aligned for 16 KB. ([Android Developers][1])

The documentscanner AAR declares a runtime dependency on com.websitebeaver:opencv 4.1.0, which bundles the OpenCV .so files (including libopencv_java4.so). ([Maven Central][2])

Impact

  • Apps using this plugin can’t meet Play’s May 31, 2026 requirement for 16 KB page size on Android 15+ targets unless the OpenCV prebuilts are rebuilt/updated. ([Android Developers][1], [Android Developers Blog][3])
  • On 16 KB devices/emulators, APK Analyzer/Lint flags “non-aligned native library” warnings, and installs or runtime linking can fail depending on packaging.

Steps to Reproduce

  1. Create a minimal Capacitor/Ionic app and add capacitor-document-scanner.
  2. Build with targetSdk 35 (Android 15) and run on a 16 KB emulator/device.
    (Verify with: adb shell getconf PAGE_SIZE16384.) ([Android Developers][1])
  3. Open APK Analyzerlib/ and check the Alignment column for OpenCV .so files (e.g., libopencv_java4.so). Studio warns about non-aligned native libraries. ([Android Developers][1])
  4. Alternatively, run: zipalign -c -P 16 -v 4 app-release.apk to see the alignment check. ([Android Developers][1])

Expected Behavior

  • Plugin ships 16 KB-compatible OpenCV libs; app installs and runs on 16 KB devices, with no Studio/Lint alignment warnings.

Actual Behavior

  • OpenCV .so bundled via com.websitebeaver:opencv isn’t 16 KB aligned, triggering warnings/failures on 16 KB environments.

Proposed Fix

  • Rebuild and release a 16 KB-compatible OpenCV AAR and bump the plugin to depend on it. Options per Android’s guidance:

    • Build with NDK r28+ (16 KB ELF alignment by default), or with NDK r27 adding -Wl,-z,max-page-size=16384. For older NDKs, also add -Wl,-z,common-page-size=16384. ([Android Developers][1])
    • Ensure packaging with AGP 8.5.1+ and uncompressed native libs so 16 KB zip alignment is applied. ([Android Developers][1])
  • Consider updating to a newer OpenCV baseline (e.g., 4.10.x) and publish a new com.websitebeaver:opencv that’s 16 KB aligned. (There’s an upstream OpenCV tracker discussing 16 KB support/alignment.) ([GitHub][4])

Acceptance Criteria

  • A released version of capacitor-document-scanner depends on a 16 KB-compatible OpenCV AAR.

  • On Android 15 16 KB emulator/device:

    • adb shell getconf PAGE_SIZE16384.
    • APK Analyzer shows no non-aligned native libraries.
    • zipalign -c -P 16 -v 4 passes for the built APK. ([Android Developers][1])

Environment

  • Capacitor 5.x (Android) with capacitor-document-scanner (current).
  • The plugin’s AAR depends on com.websitebeaver:opencv:4.1.0 per Maven POM. ([Maven Central][2])

References

  • Android Developers — Support 16 KB page sizes (official guide, with commands & build flags): explains alignment requirements, AGP 8.5.1+, NDK r27/r28, APK Analyzer, emulator setup. ([Android Developers][1])
  • Android Developers Blog — Transition to 16 KB page sizes: confirms Google Play enforcement starting Nov 1, 2025 for apps/updates targeting Android 15+. ([Android Developers Blog][3])
  • OpenCV issue re: 16 KB support/alignment (context): ([GitHub][4])

Requested Timeline

Given Google Play’s enforcement date, please target a plugin release by November 1, 2025 to allow downstream apps time to integrate and test—well ahead of the May 31, 2026 deadline. ([Android Developers Blog][3])

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