2015-08-18 4 views
3

Я пытаюсь включить Google Play Services 7.8 Face API в моем приложении, но каждый раз, когда я пытаюсь обнаружить лицо он дает мне ошибку:FaceDetectorHandle: Родной детектор лица еще не доступен. Откат к не-оп обнаружению

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

По дну сообщения Android-er Face Detection, эта проблема возникает на устройствах, работающих на Lollipop или позже. В частности, они заявили, что он работает на «RedMi 2» под управлением Android 4.4.4 с установленными сервисами Google Play версии 7.8.99, но не на Nexus 7 2012 (без фронтальной камеры) под управлением Android 5.1.1 с той же Google Play услуг версии 7.8.99 ». Он также не работает на моем OnePlus One 5.0.2. Кто-нибудь знает причину или исправить? Смог ли он в конечном итоге установить библиотеку и работать?

Редактировать: Вот несколько журналов. Я только что скопировал предупреждения журналов и выше в то время, когда использовался детектор лица, поэтому он может быть не совсем релевантным.

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() 
+0

Вы можете разместить журналы? – KayAnn

+0

Готово. Дайте мне знать, хотите ли вы больше или что-то еще. –

ответ

2

При первом запуске функции обнаружения лица на устройстве необходимо загрузить библиотеку распознавания лиц на устройство. «Нативный детектор лица еще не доступен». сообщение указывает, что библиотека еще не загружена.

Рекомендуется, чтобы зависимости мобильного зрения были добавлены в AndroidManifest.xml. Это будет проактивно запрашивать загрузку библиотеки при установке приложения. Посмотрите это замечание в документации:

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.

Как было указано выше, ваше приложение может проверить это с помощью метода isOperational():

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

Детектор будет пытаться загрузить библиотеки в то время как ваш приложение запускается и автоматически становится работоспособным после получения библиотек.

Но в некоторых случаях загрузка может не сработать (например, если на устройстве недостаточно свободного места для хранения или если устройство не подключено к сети). Первое, что нужно попробовать, - освободить больше места для хранения.

Вызов релиз()

следующее предупреждение из журнала указывает на другую проблему:

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

Ваше приложение должно вызвать метод Release() на детекторе (или источник камеры), когда он больше не нуждается в этом. Это освободит ресурсы. Хотя это не связано с проблемой загрузки, это хорошо сделать в целом. Например, если детектор был создан в деятельности, это хорошо, чтобы выпустить этот ресурс в OnDestroy():

protected void onDestroy() { 
    super.onDestroy(); 
    mCameraSource.release(); 
} 
+0

Спасибо, но, к сожалению, я уже пробовал все эти вещи. У меня много места (600 МБ), поэтому я не думаю, что это проблема. :/ –

+0

Обратите внимание, что это немного консервативно w.r.t. space - он хочет оставить на устройстве достаточное количество места. Он может не загружаться, если имеется, скажем, менее 10% свободного места. – pm0733464

+0

Мы обновили примеры приложений, включив в них низкую проверку хранилища. Например: 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

3

Служба требует Mobile Видение теперь отключена из-за проблемы с этой службой. Это не позволит пользователям, которые еще не использовали обнаружение лица или штрих-кода, использовать эти функции. Мы не рекомендуем добавлять новые приложения Mobile Vision в ваше приложение, пока эта проблема не будет исправлена.

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.

Источник: https://developers.google.com/vision/announcement

+0

В соответствии с новейшими примечаниями к выпуску служб Google Play было исправлено: https://developers.google.com/vision/release-notes#bug_fixes – Wirling