Android7.0的系统,具备root权限,执行

# adb shell
# su
# chmod 777 /dev/video0

 

在5.0的系统中可以预览图像,7.0返回无读权限

File file = new File("/dev/video0");
if (!file.exist()) {
    return;
}
if (!file.canRead()) {
    Log.v(TAG, "permission deny!")
    return;      
}

 

原来是selinux搞的鬼,adb下执行

# adb shell
# getenforce
    Enforcing

# setenforce 0   
# getenforce
    Permissive

  

打开应用,OK!  

相关文章:

  • 2021-07-23
  • 2021-12-03
  • 2021-09-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-12-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2021-07-15
相关资源
相似解决方案