mlkit icon indicating copy to clipboard operation
mlkit copied to clipboard

[Bug report] ML Kit barcode-scanning library v16.2.0 for 16 KB Page Size Compatibility

Open jackyk-cognitoiq opened this issue 4 months ago • 6 comments

Describe the bug When using ML Kit barcode-scanning library v16.2.0 and targeting Android 15 (API level 35), Android studio outputs a warning :

The native library arm64-v8a/libbarhopper_v2.so (from com.google.mlkit:barcode-scanning:16.2.0) is not 16 KB aligned

Starting November 1st, 2025, Google Play will reject new apps or updates that do not comply with the 16 KB page size requirement:

https://developer.android.com/16kb-page-size

I'm aware that the library is compatible with 16 KB page size if I upgrade to v17.3.0. However, due to the issue mentioned in https://github.com/googlesamples/mlkit/issues/367 was not resolved, we are unable to upgrade to that version.

Can you recommend how we should proceed with this? Is it possible to recompile the native library for v16.2.0?

To Reproduce Create an Android project.

Add the ML Kit barcode-scanning dependency in build.gradle - implementation 'com.google.mlkit:barcode-scanning:16.2.0'

Set compileSdk and targetSdk to 35.

Use AGP 8.5+ and Gradle 8.3+.

Observe the warning in the problems window.

Expected behavior The ML Kit barcode-scanning library should have their LOAD segments aligned at 16 KB (0x4000) boundaries, per Play policy.

🚧 Actual Behavior The affected libbarhopper_v2.so file appear to have default alignment (e.g., 4 KB), which results in compatibility issues with devices using a 16 KB page size.

SDK Info: com.google.mlkit:barcode-scanning:16.2.0

jackyk-cognitoiq avatar Sep 16 '25 15:09 jackyk-cognitoiq

Is there any solution for the com.google.mlkit:barcode-scanning:17.3.0 and the 16kb?

EduardoDevMobile avatar Sep 25 '25 18:09 EduardoDevMobile

Has anyone found a workaround for the 16 KB page-size policy when using com.google.android.gms:play-services-mlkit-barcode-scanning:18.3.1? Play Console still flags the bundled libimage_processing_util_jni.so as not supporting 16 KB pages, even on the latest version.

luckydut97 avatar Sep 30 '25 04:09 luckydut97

The same issue also exists in com.google.mlkit:barcode-scanning:17.3.0; the armeabi-v7a/libbarhopper_v3.so does not support 16KB page size. I'm using Gradle 8.13 and AGP 8.12.3.

KonoGracie avatar Sep 30 '25 07:09 KonoGracie

using latest Capacitor library there is still a problem with these libs:

  • libbarhopper_v3.so
  • libimage_processing_util_jni.so

Google Play requires us to be compatible with 16KB page size, but these libraries still have .so extension.

dnlrbz avatar Oct 03 '25 11:10 dnlrbz

iam stuck on using ML KIt library

'com.google.mlkit:language-id:17.0.6'

It generates "liblanguage_id_l2c_jni.so" which is 4 KB aligned and there is a deadline.

maaz-msf avatar Oct 03 '25 13:10 maaz-msf

The same issue also exists in com.google.mlkit:barcode-scanning:17.3.0; the armeabi-v7a/libbarhopper_v3.so does not support 16KB page size. I'm using Gradle 8.13 and AGP 8.12.3.

https://developers.google.com/ml-kit/release-notes#august_7_2024

They fixed here https://issuetracker.google.com/issues/427760954

And here a guy from Google said they won't fix: https://issuetracker.google.com/issues/437112111#comment2 (I assume it's for the 32bit arch)

Locally running a script to check the 16kb thing etc, I got from https://medium.com/easy-flutter/androids-16kb-page-size-explained-flutter-migration-made-simple-c9af18d756c1

script: https://gist.github.com/NitinPraksash9911/76f1793785a232b2aa2bc2e409873955

I've added some an ABI filter that doesn't include the armeabi-v7a. If you don't have any filter, it will add all the supported archs by default.

ndk {
    abiFilters = ['arm64-v8a', 'x86_64']
}

Remove the previous build, build it again and then run the script.

Image

I haven't tested yet (to submit to google play) but it should work I guess. The problem is if you have to drop support to that 32bit arch, people with the 32bit only, won't be able to install the latest version of your app.

Update:

I've updated flutter to lates (3.35.0) and it worked without any other changes. Meaning that the google play didn't complained about the 16kb anymore.

oguibueno avatar Oct 06 '25 20:10 oguibueno

mlkit-subject-segmentation still does not support 16 KB. I'm using com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1

Image

nightism avatar Dec 16 '25 06:12 nightism