Android 6.0 RuntimeException:无法连接到摄像头服务 [英] Android 6.0 RuntimeException: Fail to connect to camera service

查看:241
本文介绍了Android 6.0 RuntimeException:无法连接到摄像头服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序在Nexus5(Android6.0)中运行时出错。

An error occurred with my app which ran in Nexus5 (Android6.0).

错误是

java.lang.RuntimeException:无法连接到相机服务

java.lang.RuntimeException: Fail to connect to camera service

我已将权限添加到AndroidManifest.xml。

I had added the permission to the AndroidManifest.xml.

但另一部手机(Android5.1)和genymotion AVD(Android 4.0)的应用程序还可以。

But the app is OK with another phone(Android5.1), and genymotion AVD(Android 4.0).

密钥代码位于

 @Override
public void onResume() {
    super.onResume();
    try {
        mCamera = Camera.open();
    }catch (Exception e){
        Log.e(TAG,"open camera failed",e);
    }

}


推荐答案

写入你的gradle.build targetSdkVersion 22.这是一个临时解决方案但是工作。

Write in your gradle.build targetSdkVersion 22. It is a temporary solution but work.

这篇关于Android 6.0 RuntimeException:无法连接到摄像头服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆