java.lang.SecurityException:从外部存储读取时拒绝权限

时间:2022-10-12 07:44:47

I already added

我已经添加了

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

in manifest.xml, but it shows

在manifest.xml中,但它显示

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.selectmultipleimages_demo/com.selectmultipleimages_demo.CustomGallery_Activity}: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=5290, uid=10149 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission() exception

1 个解决方案

#1


1  

Followed by Android Version API 23 onwards, ie Marshmallow onward you need to get run time permission to access user's confidential data. Run time permissions is clearly explained here : Requesting Permissions at Run Time

随后是Android版API 23,即Marshmallow以后,您需要获得运行时权限才能访问用户的机密数据。此处明确说明了运行时权限:在运行时请求权限

Also, this Answer shall help you to implement run time permission for the purpose of writing to the External Storage.

此外,本答案还将帮助您实现运行时权限,以便写入外部存储。

#1


1  

Followed by Android Version API 23 onwards, ie Marshmallow onward you need to get run time permission to access user's confidential data. Run time permissions is clearly explained here : Requesting Permissions at Run Time

随后是Android版API 23,即Marshmallow以后,您需要获得运行时权限才能访问用户的机密数据。此处明确说明了运行时权限:在运行时请求权限

Also, this Answer shall help you to implement run time permission for the purpose of writing to the External Storage.

此外,本答案还将帮助您实现运行时权限,以便写入外部存储。