从uri读取时出现FileInputStream错误

时间:2016-08-20 06:46:48

标签: java android

我有这段代码:

protected String doInBackground(String... params) {

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        FileInputStream fis;
        try {
            File F = new File(FilePath);
            fis = new FileInputStream(F);
            du.Upload(fis,Fname);             
        } catch (Exception e) {
            e.printStackTrace();
        }
      }

fis正在生成以下错误:

`java.io.FileNotFoundException: /storage/emulated/0/When We Are Young(AnyMaza.Com).mp3: open failed: EACCES (Permission denied)`

FilePath是这样的:

/storage/emulated/0/When We Are Young(AnyMaza.Com).mp3

我在应用程序清单中添加了读写权限:

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

可能是什么问题?

任何帮助表示感谢。

0 个答案:

没有答案