Exception 'open failed: EACCES (Permission denied)' on Android

前端 未结 30 1621
[愿得一人]
[愿得一人] 2020-11-22 00:59

I am getting

open failed: EACCES (Permission denied)

on the line OutputStream myOutput = new FileOutputStream

30条回答
  •  别那么骄傲
    2020-11-22 01:34

    Environment.getExternalStoragePublicDirectory();
    

    When using this deprecated method from Android 29 onwards you will receive the same error:

    java.io.FileNotFoundException: open failed: EACCES (Permission denied)

    Resolution here:

    getExternalStoragePublicDirectory deprecated in Android Q

提交回复
热议问题