Android 面部检测器手柄﹕;本机人脸检测器尚不可用。恢复到无操作检测

Android 面部检测器手柄﹕;本机人脸检测器尚不可用。恢复到无操作检测,android,google-play-services,google-vision,Android,Google Play Services,Google Vision,我正在尝试将Google Play Services 7.8 Face API整合到我的应用程序中,但每次我尝试检测人脸时,都会出现错误: 面部检测手柄﹕ 本机人脸检测器尚不可用。恢复到无操作检测 根据文章的底部,这个问题发生在运行棒棒糖或更高版本的设备上。具体来说,他们说它在“RedMi 2上工作,运行Android 4.4.4,安装了Google Play services 7.8.99版,但在运行Android 5.1.1,安装了Google Play services 7.8.99版的N

我正在尝试将Google Play Services 7.8 Face API整合到我的应用程序中,但每次我尝试检测人脸时,都会出现错误:

面部检测手柄﹕ 本机人脸检测器尚不可用。恢复到无操作检测

根据文章的底部,这个问题发生在运行棒棒糖或更高版本的设备上。具体来说,他们说它在“RedMi 2上工作,运行Android 4.4.4,安装了Google Play services 7.8.99版,但在运行Android 5.1.1,安装了Google Play services 7.8.99版的Nexus 7 2012(不带前置摄像头)上不工作。”它在运行Google Play services 5.0.2的OnePlus上也不工作。有人知道原因或解决方法吗?它最终会安装库并工作吗

编辑: 这里有一些日志。我只是在使用人脸检测仪时复制了警告和更高级别的日志,所以它可能并不都相关

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

首次在设备上运行人脸检测功能时,需要将人脸检测库下载到设备上。“Native face detector not available.”消息表示库尚未下载

建议将mobile vision依赖项添加到AndroidManifest.xml中。这将在安装应用程序时主动请求库下载。请参见文档中的注释:

将Vision依赖项添加到Android清单中

将vision功能依赖项添加到项目的 AndroidManifest.xml将向安装程序指示 下载对应用程序安装时间的依赖关系。虽然这不是 严格要求,可使用户体验更好 最初运行你的应用程序。例如,将以下内容添加到 AndroidManifest.xml(在应用程序部分)将指示 应下载条形码和人脸检测相关性 在应用程序安装时:

有效的视觉相关性值为:条形码或人脸

但是,即使提供了此功能,在某些情况下 运行探测器所需的依赖项可根据需要下载 当您的应用程序第一次运行而不是在安装时运行时。 有关更多信息,请参见isOperational()和detectorIsOperational() 检查应用程序中的依赖项下载状态时

如上所述,您的应用程序可以使用isOperational()方法进行检查:

探测器将在应用程序运行时尝试下载库,并在获得库后自动运行

但在某些情况下,下载可能不会成功(例如,如果设备没有足够的可用存储空间,或者设备未连接到网络)。首先要尝试的是释放更多的存储空间

调用release()

日志中的以下警告表示另一个问题:

W/FaceDetector(25536): FaceDetector was not released with FaceDetector.release()
当你的应用程序不再需要时,应该调用探测器(或相机源)上的release()方法。这将释放资源。虽然这与下载问题无关,但总体来说还是不错的。例如,如果检测器是在活动中创建的,则最好在onDestroy()中释放该资源:


Mobile Vision所需的服务现在因该服务出现问题而被禁用。这将阻止尚未使用人脸或条形码检测的用户使用这些功能。在解决此问题之前,我们不建议在应用程序中添加新的Mobile Vision功能

公告

有一项服务可以下载Mobile Vision运行所需的文件,但由于在开发后期发现了一个严重的错误,该服务现在被禁用。这将防止尚未使用人脸或条形码检测的用户使用人脸或条形码扫描。我们向Google Play Services开发者提供以下建议:

在解决此问题之前,请勿添加新的Mobile Vision功能。 对于已经使用移动视觉功能的应用程序,请调用FaceDetector.isOperational()或BarcodeDetector.isOperational()检查探测器是否准备就绪,并相应降低功能操作。 我们正在努力尽快解决这个问题。我们预计需要几周的时间来彻底测试它


来源:

完成。如果你想要更多或其他什么,请告诉我。谢谢,但不幸的是,我已经尝试了所有这些东西。我有足够的空间(600 MB),所以我认为这不是问题所在/请注意,这是一个有点保守的w.r.t.空间——它希望在设备上留下相当多的可用空间。比如说,如果可用空间不足10%,它可能无法下载。我们更新了示例应用程序,以包含低存储检查。例如:@pm0733464在我的例子中,低存储检查没有警告我存储空间低,但库仍然没有下载。我的日志中有与OP相同的错误。有没有办法调整lib的保守行为?除了最后一条日志消息外,上面的其他日志消息都与人脸检测器无关。我建议您在日志中搜索带有“Vision”或“DownloadManager”标签的条目,并告诉我您找到了什么。根据Google Play Services的最新发布说明,它已修复:
protected void onDestroy() {
    super.onDestroy();
    mCameraSource.release();
}