MLKit Android:使用文本识别时崩溃

MLKit Android : crash when using text recognition

提问人:QuentR 提问时间:11/14/2023 更新时间:11/14/2023 访问量:22

问:

前段时间,我启动了一项新功能,允许您读取身份证的 MRZ 条。 但是,我想重新测试此功能,但它不再起作用。

根据我使用的内容,我得到不同的错误:

implementation 'com.google.android.gms:play-services-mlkit-text-recognition:19.0.0'
Text recognition failed
 com.google.mlkit.common.MlKitException: Failed to init text recognizer play-services-mlkit-text-recognition
    at com.google.mlkit.vision.text.internal.zzc.zza(com.google.android.gms:play-services-mlkit-text-recognition-common@@19.0.0:5)
    at com.google.mlkit.vision.text.internal.TextRecognizerTaskWithResource.zze(com.google.android.gms:play-services-mlkit-text-recognition-common@@19.0.0:2)
    at com.google.mlkit.vision.text.internal.TextRecognizerTaskWithResource.run(com.google.android.gms:play-services-mlkit-text-recognition-common@@19.0.0:1)
    at com.google.mlkit.vision.common.internal.MobileVisionBase.zza(com.google.mlkit:vision-common@@17.3.0:2)
    at com.google.mlkit.vision.common.internal.zza.call(Unknown Source:4)
    at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@18.8.0:8)
    at com.google.mlkit.common.sdkinternal.zzn.run(Unknown Source:10)
    at com.google.mlkit.common.sdkinternal.zzt.run(com.google.mlkit:common@@18.8.0:2)
    at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zze(com.google.mlkit:common@@18.8.0:4)
    at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzc(com.google.mlkit:common@@18.8.0:1)
    at com.google.mlkit.common.sdkinternal.zzk.run(Unknown Source:2)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(com.google.mlkit:common@@18.8.0:2)
    at com.google.mlkit.common.sdkinternal.zzi.run(Unknown Source:2)
    at java.lang.Thread.run(Thread.java:919)
 Caused by: android.os.RemoteException: Failed to initialize TfLite-GMS
    at m.vd.c(:com.google.android.gms.optional_mlkit_ocr_common@[email protected] (100400-0):279)
    at m.bly.a(:com.google.android.gms.optional_mlkit_ocr_common@[email protected] (100400-0):112)
    at m.bp.onTransact(:com.google.android.gms.optional_mlkit_ocr_common@[email protected] (100400-0):21)
    at android.os.Binder.transact(Binder.java:914)
    at com.google.android.gms.internal.mlkit_vision_text_common.zza.zzc(com.google.android.gms:play-services-mlkit-text-recognition-common@@19.0.0:2)
    at com.google.android.gms.internal.mlkit_vision_text_common.zzrw.zze(com.google.android.gms:play-services-mlkit-text-recognition-common@@19.0.0:2)
    at com.google.mlkit.vision.text.internal.zzc.zza(com.google.android.gms:play-services-mlkit-text-recognition-common@@19.0.0:3)
    at com.google.mlkit.vision.text.internal.TextRecognizerTaskWithResource.zze(com.google.android.gms:play-services-mlkit-text-recognition-common@@19.0.0:2) 
    at com.google.mlkit.vision.text.internal.TextRecognizerTaskWithResource.run(com.google.android.gms:play-services-mlkit-text-recognition-common@@19.0.0:1) 
    at com.google.mlkit.vision.common.internal.MobileVisionBase.zza(com.google.mlkit:vision-common@@17.3.0:2) 
    at com.google.mlkit.vision.common.internal.zza.call(Unknown Source:4) 
    at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@18.8.0:8) 
    at com.google.mlkit.common.sdkinternal.zzn.run(Unknown Source:10) 
    at com.google.mlkit.common.sdkinternal.zzt.run(com.google.mlkit:common@@18.8.0:2) 
    at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zze(com.google.mlkit:common@@18.8.0:4) 
    at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzc(com.google.mlkit:common@@18.8.0:1) 
    at com.google.mlkit.common.sdkinternal.zzk.run(Unknown Source:2) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
    at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(com.google.mlkit:common@@18.8.0:2) 
    at com.google.mlkit.common.sdkinternal.zzi.run(Unknown Source:2) 
    at java.lang.Thread.run(Thread.java:919) 
 Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.DelegateLastClassLoader[DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/0000013b/dl-MlkitOcrCommon.optional_234414100400.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/0000013b/dl-MlkitOcrCommon.optional_234414100400.apk!/lib/armeabi-v7a, /data/user_de/0/com.google.android.gms/app_chimera/m/0000013b/dl-MlkitOcrCommon.optional_234414100400.apk!/lib/armeabi, /system/lib, /system/product/lib]]] couldn't find "libmlkit_google_ocr_pipeline_gms.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)

如果我使用这样的捆绑版本和这个依赖项:

实现“com.google.mlkit:text-recognition:16.0.0”

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/APPNAME-HMyTa1XfEYw4eV3v5DEB_w==/base.apk"],nativeLibraryDirectories=[/data/app/APPNAME-HMyTa1XfEYw4eV3v5DEB_w==/lib/arm, /data/app/APPNAME-HMyTa1XfEYw4eV3v5DEB_w==/base.apk!/lib/armeabi, /system/lib, /system/product/lib]]] couldn't find "libmlkit_google_ocr_pipeline.so"

知道是什么导致了这些问题吗?代码正在工作,有一天我没有修改它就不再工作了。

我在项目的 GitHub Issue 页面上搜索,但找不到任何解决方案。

java android 崩溃 google-mlkit 文本识别

评论

0赞 tomerpacific 11/14/2023
似乎是库内部的。您是否尝试过在初始化期间调试它内部发生的事情?

答: 暂无答案