安卓6.0打开失败:EACCES(权限被拒绝) [英] Android 6.0 open failed: EACCES (Permission denied)

查看:1862
本文介绍了安卓6.0打开失败:EACCES(权限被拒绝)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不添加使用-许可包括<$c$c>WRITE_EXTERNAL_STORAGE,<$c$c>MOUNT_UNMOUNT_FILESYSTEMS,<$c$c>READ_EXTERNAL_STORAGE的Andr​​oidManifest.xml

I had add uses-permission including WRITE_EXTERNAL_STORAGEMOUNT_UNMOUNT_FILESYSTEMSREAD_EXTERNAL_STORAGE to AndroidManifest.xml.

当我跑在Nexus5(Android6.0)我的应用程序,它抛出一个异常,如下:

When I ran my app in Nexus5(Android6.0),it threw a exception as below:

java.io.IOException异常:打开失败:EACCES(权限被拒绝)

和我尝试另一个Android手机(Android5.1),一切都OK.Here是在code:

And I tried another Android phone(Android5.1),everything was OK.Here's the code:

private File createImageFile() throws IOException {
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    String imageFileName = "JPEG_" + timeStamp + "_";
    File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
    File image = File.createTempFile(imageFileName, ".jpg", storageDir);
    currentPhotoPath = image.getAbsolutePath();
    return image;
}

难道Android的6.0有关于许可的区别?

Does Android 6.0 have difference about permission?

推荐答案

的Andr​​oid增添了新的许可模式为Android 6.0(MARSHMELLOW)。

Android added new permission model for Android 6.0 (Marshmellow).

<一个href="http://www.captechconsulting.com/blogs/runtime-permissions-best-practices-and-how-to-gracefully-handle-permission-removal">http://www.captechconsulting.com/blogs/runtime-permissions-best-practices-and-how-to-gracefully-handle-permission-removal

所以,你必须检查运行权限

什么是运行权限?

使用的Andr​​oid 6.0棉花糖,谷歌推出了新的许可模式,让用户能够更好地理解为什么一个应用程序可以请求特定的权限。而不是盲目地接受所有权限,在安装时用户,用户通过提示接受的权限,因为他们在应用程序的使用成为必需。

With Android 6.0 Marshmallow, Google introduced a new permission model that allows users to better understand why an application may be requesting specific permissions. Rather than the user blindly accepting all permissions at install time, the user is now prompted to accept permissions as they become necessary during application use.

当执行新的模式?

它不要求完全支持,直到您选择定位在你的应用程序版本23。如果你的目标版本22或以下时,你的应用程序将要求所有权限在安装时,就像它会运行下面棉花糖操作系统的任何设备。

it doesn’t require full support until you choose to target version 23 in your application. If you are targeting version 22 or below, your application will request all permissions at install time just as it would on any device running an OS below Marshmallow.

此信息是从这里:

请查看如何从这个链接实现:

Please check How to implement from this link :

<一个href="http://www.captechconsulting.com/blogs/runtime-permissions-best-practices-and-how-to-gracefully-handle-permission-removal">http://www.captechconsulting.com/blogs/runtime-permissions-best-practices-and-how-to-gracefully-handle-permission-removal

这篇关于安卓6.0打开失败:EACCES(权限被拒绝)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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