Skip to content

ML Kit native libraries not 16KB aligned – fails stripReleaseDebugSymbols in AGP 8.5+ #947

Open
@adarsh-dhakad

Description

@adarsh-dhakad

When using com.google.mlkit:barcode-scanning:17.3.0, the release build fails alignment verification on Android Gradle Plugin (AGP) 8.5.1 due to native .so libraries not being aligned to 16KB as required. This leads to the following warning in the build log:

    Task :app:stripReleaseDebugSymbols
    Unable to strip the following libraries, packaging them as they are:
    libbarhopper_v3.so, libimage_processing_util_jni.so, libsurface_util_jni.so

This violates ELF alignment requirements introduced in AGP 8.5+, affecting reproducible and compliant builds.

To Reproduce
Steps to reproduce the behavior in a sample Android app:

Add ML Kit dependency:
implementation 'com.google.mlkit:barcode-scanning:17.3.0'

Build a release APK using AGP 8.5.1
Observe build logs or run alignment verification with check_elf_alignment.sh
See ELF alignment errors on .so files

Expected behavior
The native .so libraries (libbarhopper_v3.so, libimage_processing_util_jni.so, libsurface_util_jni.so) should be aligned to 16KB (2¹⁴) so that AGP 8.5+ builds can strip symbols and package them correctly without warnings or errors.

SDK Info:
-SDK Name & Version: com.google.mlkit:barcode-scanning:17.3.0

Smartphone:
Device/Simulator: Pixel 6, emulator also affected
Device/Simulator OS: Android 14 (API 34), also tested on Android 13

Development Environment:
IDE Version: Android Studio Meerkat | 2024.3.1
Laptop/Desktop: MacBook Pro (M2, 2022)
Laptop/Desktop OS: macOS 14.4 Sonoma

Metadata

Metadata

Assignees

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