Android 10上读取sdcard中的文件时出现open failed EACCES (Permission denied)

Android 2年前 (2021) 125la.com站长
279 1 0
广告也精彩

前言

最近Android 10上读取文件时,出现如下异常:

03-27 01:07:14.882 W/System.err(18732): java.io.FileNotFoundException: /storage/udisk2/wawa.mp3: open failed: EACCES (Permission denied)
03-27 01:07:14.882 W/System.err(18732):         at libcore.io.IoBridge.open(IoBridge.java:496)
03-27 01:07:14.882 W/System.err(18732):         at java.io.FileInputStream.<init>(FileInputStream.java:159)
03-27 01:07:14.882 W/System.err(18732):         at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1184)
03-27 01:07:14.883 W/System.err(18732):         at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1162)
03-27 01:07:14.883 W/System.err(18732):         at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1127)
03-27 01:07:14.883 W/System.err(18732):         at com.la.mediabutton.TMediaService.onStartCommand(TMediaService.java:71)
03-27 01:07:14.883 W/System.err(18732):         at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4165)
03-27 01:07:14.883 W/System.err(18732):         at android.app.ActivityThread.access$1800(ActivityThread.java:234)
03-27 01:07:14.883 W/System.err(18732):         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1914)
03-27 01:07:14.883 W/System.err(18732):         at android.os.Handler.dispatchMessage(Handler.java:107)
03-27 01:07:14.884 W/System.err(18732):         at android.os.Looper.loop(Looper.java:214)
03-27 01:07:14.884 W/System.err(18732):         at android.app.ActivityThread.main(ActivityThread.java:7626)
03-27 01:07:14.884 W/System.err(18732):         at java.lang.reflect.Method.invoke(Native Method)
03-27 01:07:14.884 W/System.err(18732):         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503)
03-27 01:07:14.884 W/System.err(18732):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
03-27 01:07:14.885 W/System.err(18732): Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
03-27 01:07:14.885 W/System.err(18732):         at libcore.io.Linux.open(Native Method)
03-27 01:07:14.885 W/System.err(18732):         at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
03-27 01:07:14.885 W/System.err(18732):         at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
03-27 01:07:14.886 W/System.err(18732):         at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
03-27 01:07:14.886 W/System.err(18732):         at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7500)
03-27 01:07:14.886 W/System.err(18732):         at libcore.io.IoBridge.open(IoBridge.java:482)

广告也精彩

相关文章

广告也精彩