question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android face detection doesn't work in a system app

See original GitHub issue

Hello, I’m currently working on a system app that would run on an AOSP box.

I tried to recognize faces with cameraX, and got this error : E/MobileVisionBase: Error preloading model resource when calling process method on the FaceDetector

The sample app works fine on the box so I assume that my problem comes from the system app status. For information I use the bundle model.

Here is the full trace :

2020-07-27 15:53:07.084 11115-11115/fr.technosens.eliodroid.ebox E/MobileVisionBase: Error preloading model resource
    com.google.mlkit.common.MlKitException: Internal error has occurred when executing ML Kit tasks
        at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@16.0.0:28)
        at com.google.mlkit.common.sdkinternal.zzn.call(Unknown Source:6)
        at com.google.mlkit.common.sdkinternal.zzm.run(com.google.mlkit:common@@16.0.0:5)
        at com.google.mlkit.common.sdkinternal.zzq.run(com.google.mlkit:common@@16.0.0:3)
        at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(com.google.mlkit:common@@16.0.0:24)
        at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zza(com.google.mlkit:common@@16.0.0:30)
        at com.google.mlkit.common.sdkinternal.zzj.run(Unknown Source:2)
        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:764)
     Caused by: java.lang.SecurityException: Failed to find provider com.google.android.gsf.gservices for user 0; expected to find a valid ContentProvider for this authority
        at android.os.Parcel.readException(Parcel.java:1951)
        at android.os.Parcel.readException(Parcel.java:1897)
        at android.content.IContentService$Stub$Proxy.registerContentObserver(IContentService.java:768)
        at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1924)
        at android.content.ContentResolver.registerContentObserver(ContentResolver.java:1913)
        at com.google.android.gms.internal.vision.zzba.<init>(com.google.android.gms:play-services-vision-common@@19.1.0:11)
        at com.google.android.gms.internal.vision.zzba.zze(com.google.android.gms:play-services-vision-common@@19.1.0:5)
        at com.google.android.gms.internal.vision.zzbj.zzae(com.google.android.gms:play-services-vision-common@@19.1.0:71)
        at com.google.android.gms.internal.vision.zzbj.get(com.google.android.gms:play-services-vision-common@@19.1.0:50)
        at com.google.android.gms.internal.vision.zzlb.zzjq(com.google.android.gms:play-services-vision-common@@19.1.0:2)
        at com.google.android.gms.internal.vision.zzla.zzjq(com.google.android.gms:play-services-vision-common@@19.1.0:1)
        at com.google.android.gms.internal.vision.zzs.<init>(com.google.android.gms:play-services-vision-common@@19.1.0:14)
        at com.google.android.gms.vision.face.internal.client.zzb.<init>(com.google.android.gms:play-services-vision@@20.1.0:1)
        at com.google.android.gms.vision.face.FaceDetector$Builder.build(com.google.android.gms:play-services-vision@@20.1.0:40)
        at com.google.mlkit.vision.face.internal.zzd.load(com.google.android.gms:play-services-mlkit-face-detection@@16.1.0:37)
        at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@16.0.0:22)
        at com.google.mlkit.common.sdkinternal.zzn.call(Unknown Source:6) 
        at com.google.mlkit.common.sdkinternal.zzm.run(com.google.mlkit:common@@16.0.0:5) 
        at com.google.mlkit.common.sdkinternal.zzq.run(com.google.mlkit:common@@16.0.0:3) 
        at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(com.google.mlkit:common@@16.0.0:24) 
        at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zza(com.google.mlkit:common@@16.0.0:30) 
        at com.google.mlkit.common.sdkinternal.zzj.run(Unknown Source:2) 
        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:764) 

Any idea to solve this issue ? Or did I missed something ?

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
sheepmastercommented, Jul 29, 2020

So, a new ML Kit release came out yesterday, but the release doesn’t include com.google.android.gms:play-services-vision, which is where the fix is. I’ve filed an internal bug to include it in the next release, which should hopefully be in a few weeks.

1reaction
sheepmastercommented, Jul 28, 2020

FYI, unobfuscated stack trace is here (internal only, sry). It looks like even though the app is using the bundled model, there is a code path that checks whether to use a particular variant of the Google Play Services model, which fails to find a ContentProvider in Google Play Services. From searching the error message, it seems that this does in fact happen when Google Play Services is not installed, but maybe there is something particular about your configuration that causes the exception but doesn’t in the “usual” AOSP configuration. In any case, this code path has recently been removed, so the crash should go away in the next release of ML Kit. Stay tuned 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Top 7 Ways to Fix Face Recognition Not Working on Samsung ...
Step 1: Open the Face recognition option in the Biometrics and Security menu. Step 2: Disable Require open eyes.
Read more >
Samsung S20/S21/S22 Face Recognition Not Working?9 ...
Are you facing Samsung face recognition not working issue on your device? Here are the top methods to deal with facial recognition problems....
Read more >
android - Face detection not working - Stack Overflow
If you know the orientation, you can set it in creating the Frame. The face detector will take this into account, and will...
Read more >
Face recognition/unlock stopped to work after last update
Try to - delete your face from phone. Then in apps find Asus Face Unlock Service - force stop, then clear internal memory....
Read more >
Android Face Detection - DigitalOcean
detector.isOperational() is used to check whether the current Google Play Services library in your phone supports the vision API(If it doesn't ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found