5

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
svprdga
  • 1,531
  • 1
  • 18
  • 35
  • 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? – Shiyu Sep 16 '20 at 17:16
  • @Shiyu the dependency is com.google.mlkit:barcode-scanning:16.0.2, and I am building an app bundle – svprdga Sep 17 '20 at 10:06
  • Okay, could you make sure the .so file is within your base.apk? – Shiyu Sep 18 '20 at 17:45
  • 1
    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. – svprdga Sep 19 '20 at 09:54
  • 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 debug – Shiyu Sep 19 '20 at 23:53
  • Yes, I have edited the question with the affected devices. Thanks. – svprdga Sep 20 '20 at 10:23
  • 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? – Shiyu Sep 20 '20 at 23:09
  • 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... – svprdga Sep 21 '20 at 11:46
  • 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. – Amila Abeygunasekara Sep 25 '20 at 03:56
  • @Shiyu 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! – Duy Pham Jan 07 '21 at 12:36

2 Answers2

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.

Luis Ventura
  • 519
  • 3
  • 5
-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.

Shiyu
  • 562
  • 2
  • 4
  • 1
    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 remains – svprdga Oct 24 '20 at 08:22
  • Did you manage to fix the issue? – Ankit Batra May 15 '21 at 10:54
  • @AnkitBatra no, I continue to have this issue. I have to say that I haven't updated the lib since half a year. – svprdga May 18 '21 at 09:41