Google ML Kit: couldn't find "libbarhopper_v2.so"
Asked Answered
P

2

9

I recently changed my old barcode/QR scanning library in favor of the Google ML Kit for barcode scanning, and since I did I am receiving some new crash reports through crashlytics that I didn't have before.

Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.my.app-Q4EYyt2jmFlLaZ-mHL-J5A==/base.apk"],nativeLibraryDirectories=[/data/app/com.my.app-Q4EYyt2jmFlLaZ-mHL-J5A==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64]]] couldn't find "libbarhopper_v2.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1011) at java.lang.System.loadLibrary(System.java:1660) at com.google.android.libraries.barhopper.BarhopperV2.(BarhopperV2.java:5) at com.google.mlkit.vision.barcode.zza.a_(zza.java:7) at com.google.mlkit.vision.barcode.internal.zzf.b(zzf.java:17) at com.google.mlkit.common.sdkinternal.ModelResource.zza(ModelResource.java:1) at com.google.mlkit.common.sdkinternal.zzl.run(zzl.java:1) at com.google.mlkit.common.sdkinternal.zzp.run(zzp.java:3) at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(MlKitThreadPool.java:19) at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zza(MlKitThreadPool.java:1) at com.google.mlkit.common.sdkinternal.zzh.run(zzh.java:1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:784)

Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.my.app-Y8cCSVtTMYVdnQQovlR0cw==/base.apk"],nativeLibraryDirectories=[/data/app/com.my.app-Y8cCSVtTMYVdnQQovlR0cw==/lib/arm, /system/lib, /vendor/lib]]] couldn't find "libbarhopper_v2.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1067) at java.lang.Runtime.loadLibrary0(Runtime.java:1007) at java.lang.System.loadLibrary(System.java:1667) at com.google.android.libraries.barhopper.BarhopperV2.(BarhopperV2.java:5) at com.google.mlkit.vision.barcode.zza.a_(zza.java:7) at com.google.mlkit.vision.barcode.internal.zzf.b(zzf.java:17) at com.google.mlkit.common.sdkinternal.ModelResource.zza(ModelResource.java:1) at com.google.mlkit.common.sdkinternal.zzl.run(zzl.java:1) at com.google.mlkit.common.sdkinternal.zzp.run(zzp.java:3) at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(MlKitThreadPool.java:19) at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zza(MlKitThreadPool.java:1) at com.google.mlkit.common.sdkinternal.zzh.run(zzh.java:1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)

In short it all comes down to this couldn't find "libbarhopper_v2.so" error.

Anyone knows how to fix this?

============

EDIT: List of affected devices:

  • Samsung Galaxy A6, Android 10
  • Samsung Galaxy J7 Max, Android 8.1.0
  • Xiaomi Redmi Go, Android 8.1.0
  • Samsung Galaxy Grand Prime, Android 5.1.1
  • Motorola Moto G (2nd Gen)
  • OPPO A33w, Android 5.1
  • Starmobile Play Plus
  • Samsung Galaxy J2 Pro, Android 6.0.1
  • Huawei Y3III, Android 6.0
  • Huawei GR5, Android 6.0.1
  • Motorola Moto X Play, Android 7.1.1
  • Huawei G Elite Plus, Android 7.0
  • Samsung Galaxy J6, Android 9
  • Samsung Galaxy J7 Prime, Android 7.0
  • Lenovo Vibe k6, Android 7.0
  • Wiko Pulp Fab 4G, Android 5.1.1
Postmortem answered 15/9, 2020 at 11:40 Comment(10)
What dependency are you using? the 'com.google.mlkit:barcode-scanning' or 'com.google.android.gms:play-services-mlkit-barcode-scanning'? Also, how do you compile your app, do you build an APK or app bundle?Whimsey
@Whimsey the dependency is com.google.mlkit:barcode-scanning:16.0.2, and I am building an app bundlePostmortem
Okay, could you make sure the .so file is within your base.apk?Whimsey
Yes, the libbarhopper_v2.so library is within the apk; in fact the apk itself works as expected to 99% of users. The error is only happening to a little portion of them.Postmortem
Could you provide more info about the little portion of the devices? like device brand, build or so. That would be helpful for us to debugWhimsey
Yes, I have edited the question with the affected devices. Thanks.Postmortem
Thanks! We could try it on some these devices. At the same time, could you verify the .so file is properly downloaded in these devices?Whimsey
Unfortunately I cant, those devices are from my users, people that I don't know, the only thing I have about them is the information that my analytics tools give me...Postmortem
I'm also getting this error. It's very rare but one user (Galaxy J7 V) keeps getting it. I'm also using the BarhopperV2, which bundles within the app itself.Tantalate
@Whimsey my app also has a lot of crashes like this. I could reproduce sometime when I build and run the app on some emulators. But interesting that the crash only happens at the first time the adb run it automatically after the build done; re-open it -> work normally without crashes!Pich
D
0

This stopped happening after I disabled "Allow parallel run" in the project's run configurations, which I disabled for another unrelated issue.

It happened consistently on the first run as OP stated, but didn't happen on the second run onwards.

Interestingly, it never happened to any of my users, only to devs.

Dysentery answered 11/4, 2021 at 4:11 Comment(0)
W
-1

There is an open-bug for App bundle: https://issuetracker.google.com/issues/127691101

Based on the bug, you may set android:extractNativeLibs to true in the manifest to give a try.

Whimsey answered 2/10, 2020 at 18:12 Comment(3)
After trying the suggested solution: extractNativeLibs=true in AndnroidManifest.xml android.bundle.enableUncompressedNativeLibs=false in gradle.properties I can confirm that this fix is NOT working and the issue remainsPostmortem
@AnkitBatra no, I continue to have this issue. I have to say that I haven't updated the lib since half a year.Postmortem
It doesn't seem related. That bug mentions a "Permission denied" while the question seems like the library cannot be found.Fachini

© 2022 - 2024 — McMap. All rights reserved.