且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-02-19 21:26:12

请添加权限允许应用程序写入到外部存储。

please add the permission for Allows an application to write to external storage.

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

允许应用程序从外部存储器读取。

Allows an application to read from external storage.

任何应用程序,声明WRITE_EXTERNAL_STORAG​​E权限隐式授予此权限。

Any app that declares the WRITE_EXTERNAL_STORAGE permission is implicitly granted this permission.

此权限执行的起始在API级19之前的API级别19,此权限不执行,所有的应用程序仍可以访问外部存储器读取。您可以通过启用保护USB存储下,在设备上设置应用程序开发者的选择运行Android 4.1或更高版本强制许可测试您的应用程序。

This permission is enforced starting in API level 19. Before API level 19, this permission is not enforced and all apps still have access to read from external storage. You can test your app with the permission enforced by enabling Protect USB storage under Developer options in the Settings app on a device running Android 4.1 or higher.