3

I'm trying to incorporate the Google Play Services 7.8 Face API in my app, but every time I try to detect faces it gives me the error:

FaceDetectorHandle﹕ Native face detector not yet available. Reverting to no-op detection

According to the bottom of the post Android-er Face Detection, this problem occurs on devices running Lollipop or later. Specifically, they said it works on a "RedMi 2, running Android 4.4.4 with Google Play services version 7.8.99 installed, but not on a Nexus 7 2012 (WITHOUT front camera) running Android 5.1.1, with the same Google Play services version 7.8.99 installed." It also doesn't work on my OnePlus One running 5.0.2. Does anyone know the cause or fix? Will it eventually install the library and work?

Edit: Here are some logs. I just copied logs warning and higher around the time that the face detector was used, so it might not all be relevant.

08-19 17:29:17.828 W/ResourcesManager(25536): Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
08-19 17:29:17.828 W/ResourcesManager(25536): Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
08-19 17:29:17.908 W/FaceDetectorHandle(25536): Native face detector not yet available.  Reverting to no-op detection.
08-19 17:29:18.060 W/ResourcesManager(25536): Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
08-19 17:29:18.060 W/ResourcesManager(25536): Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
08-19 17:29:20.267 W/LatinIME( 1645): Deprecated private IME option specified: nm,com.google.android.inputmethod.latin.noGestureFloatingPreview
08-19 17:29:20.267 W/LatinIME( 1645): Use com.google.android.inputmethod.latin.noMicrophoneKey instead
08-19 17:29:20.294 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.306 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.317 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.532 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: CoreSuggestionView, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: CoreSuggestionView, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: CoreSuggestionView, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: NowProgressBar, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: CrossfadingWebImageView, destroying layer...
08-19 17:29:20.655 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: ew, destroying layer...
08-19 17:29:20.912 W/LatinIME( 1645): Deprecated private IME option specified: nm,com.google.android.inputmethod.latin.noGestureFloatingPreview
08-19 17:29:20.912 W/LatinIME( 1645): Use com.google.android.inputmethod.latin.noMicrophoneKey instead
08-19 17:29:20.924 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.934 W/Search.SearchUrlHelper( 1969): URL param or header with a key: "oq" has an empty value.
08-19 17:29:20.941 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:20.956 E/EntSec  (  923): [QSB   ] [QSB_CLIENT ] No connection with the NQS
08-19 17:29:21.038 W/IInputConnectionWrapper( 1814): performPrivateCommand on inactive InputConnection
08-19 17:29:21.085 W/BindingManager( 1969): Cannot call determinedVisibility() - never saw a connection for the pid: 1969
08-19 17:29:21.764 W/VelvetPresenter( 1969): Still observing while not the active client
08-19 17:29:21.765 W/VelvetPresenter( 1969): Still observing while not the active client
08-19 17:29:22.067 W/BindingManager( 1969): Cannot call determinedVisibility() - never saw a connection for the pid: 1969
08-19 17:29:22.250 W/WebViewRenderState( 1969): resultsPageEnd: not current commit, new=27, committed=0
08-19 17:29:22.344 W/SurfaceFlinger(  243): couldn't log to binary event log: overflow.
08-19 17:29:22.371 W/OpenGLRenderer( 1814): Incorrectly called buildLayer on View: ew, destroying layer...
08-19 17:29:22.462 E/WebViewWorkerImpl( 1969): onShowedSrp: No SearchResult found being shown in WebView.
08-19 17:29:26.635 W/FaceDetector(25536): FaceDetector was not released with FaceDetector.release()
pm0733464
  • 2,862
  • 14
  • 16
Tony Wickham
  • 4,706
  • 3
  • 29
  • 35

2 Answers2

3

The first time that face detection functionality is run on a device, it is necessary to download a face detection library to the device. The "Native face detector not yet available." message indicates that the library has not yet been downloaded.

It's recommended that the mobile vision dependencies are added to the AndroidManifest.xml. This will proactively request the library download when the app is installed. See this note in the docs:

Add the Vision Dependency to your Android Manifest

Adding the vision functionality dependency to your project's AndroidManifest.xml will indicate to the installer that it should download the dependency on app install time. Although this is not strictly required, it can make the user experience better when initially running your app. For example, adding the following to AndroidManifest.xml (in the application section) will indicate that both the barcode and face detection dependencies should be downloaded at app install time:

<meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode,face">

Valid vision dependency values are: barcode or face

However, even if this is supplied, in some cases the dependencies required to run the detectors may be downloaded on demand when your app is run for the first time rather than at install time. See isOperational() and detectorIsOperational() for more information on checking the dependency download status in your app.

As indicated above, your app can check for this with the isOperational() method:

https://developers.google.com/android/reference/com/google/android/gms/vision/face/FaceDetector.html#isOperational()

The detector will try to download the libraries while your app is running, and will automatically become operational once the libraries have been obtained.

But in some cases the download might not succeed (e.g., if the device does not have sufficient free storage space, or if the device isn't connected to the network). The first thing to try would be freeing up more storage space.

Calling release()

The following warning from the log indicates a different issue:

W/FaceDetector(25536): FaceDetector was not released with FaceDetector.release()

Your app should call the release() method on the detector (or camera source) when it no longer needs it. This will free up resources. Although this isn't related to the download issue, it is good to do in general. For example, if the detector was created in an activity, it's good to release that resource in onDestroy():

protected void onDestroy() {
    super.onDestroy();
    mCameraSource.release();
}
pm0733464
  • 2,862
  • 14
  • 16
  • Thanks, but unfortunately I've already tried all of those things. I have plenty of space (600 MB), so I don't think that's the issue. :/ – Tony Wickham Aug 20 '15 at 15:41
  • Note that it is a bit conservative w.r.t. space -- it wants to leave a fair amount of space available on the device. It may not download if there is, say, less than about 10% free space available. – pm0733464 Aug 20 '15 at 15:47
  • We updated the sample apps to include a low storage check. For example: https://github.com/googlesamples/android-vision/blob/master/visionSamples/photo-demo/app/src/main/java/com/google/android/gms/samples/vision/face/photo/PhotoViewerActivity.java#L91 – pm0733464 Sep 16 '15 at 19:05
  • @pm0733464 in my case the low storage check doesn't warn me about low storage, but still the library doesn't get downloaded. I have the same errors as OP in my logcat. Is there any way to tweak the conservative behavior of lib? – Michał Klimczak Sep 21 '15 at 18:37
  • With the exception of the last log message, none of the other log messages above are related to the face detector. I'd suggest searching your logs for entries with the "Vision" or "DownloadManager" tags and let me know what you find. – pm0733464 Sep 21 '15 at 22:39
  • what happens if a client device is not updated to the latest google play services version, is that gonna effect the download process? – feisal Mar 23 '16 at 00:23
  • The client doesn't need the latest version, but they'd need to have at least google play services version 7.8, which was rolled out last August. Note that all users get these updates, even if they are on an older version of Android. However, if a client lacks free storage space, they may not be able to receive the update. – pm0733464 Mar 23 '16 at 14:47
3

A service required by Mobile Vision is now disabled due to an issue with that service. This will prevent users who have not already used face or barcode detection from using those features. We do not recommend adding new Mobile Vision features to your app until this issue is fixed.

Announcement

There is a service that downloads files required by Mobile Vision to run but is now disabled due to a serious bug discovered late in development. This will prevent users who have not already used Face or Barcode detection from using Face or Barcode scanning. We offer the following advice to Google Play Services developers:

Do not add new Mobile Vision features until this issue is fixed. For apps that already use Mobile Vision functions, call FaceDetector.isOperational() or BarcodeDetector.isOperational() to check for detector readiness and degrade feature operation accordingly. We are working to correct the problem as soon as possible. We expect it will take several weeks to test it thoroughly.

Source: https://developers.google.com/vision/announcement

Community
  • 1
  • 1
Adarsh Sharma
  • 472
  • 2
  • 15
  • According to the newest release notes of Google Play Services it was fixed: https://developers.google.com/vision/release-notes#bug_fixes – Wirling Jun 29 '16 at 06:21