【发布时间】:2016-10-17 09:08:59
【问题描述】:
我正在将相机用于条码扫描仪应用,并且在某些设备(LG G Flex、华硕 Nexus 7)上得到:Android 运行时异常 - 无法连接相机服务。 这是下面清单文件中的 sn-p:
`uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
uses-permission android:name="android.permission.CAMERA"
....`
我在暂停、停止和销毁时释放相机。
/**
* Restarts the camera.
*/
@Override
protected void onResume() {
super.onResume();
try {
startCameraSource();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Stops the camera.
*/
@Override
protected void onPause() {
super.onPause();
if (mPreview != null) {
mPreview.stop();
}
}
/**
* Releases the resources associated with the camera source, the associated detectors, and the
* rest of the processing pipeline.
*/
@Override
protected void onDestroy() {
super.onDestroy();
if (mPreview != null) {
mPreview.release();
}
}
仍然超出运行时异常,并且我没有以上两个设备,因此我可以重现。 这个问题有解决办法吗?
【问题讨论】:
标签: android camera android-vision