1
三星T230 (是Android 4.4.2)它工作在以下两个'打开失败:EACCES(拒绝)' 在Android
File firstFile = new File("mnt/extSdCard/Android/data/com.example.storagetest", "test.txt");
RandomAccessFile fileLittle = new RandomAccessFile(firstFile, "rw");
File scndFile = new File("mnt/extSdCard/Android/data/com.example.storagetest", "test2.txt");
scndFile.createNewFile();
我已经尝试了很多这些设备正在以这种方式工作。 T230是一个例子
关于Hometech平板电脑(Android 5.1.1)不起作用。
File firstFile = new File("mnt/external_sd/Android/data/com.example.storagetest", "test.txt");
RandomAccessFile fileLittle = new RandomAccessFile(firstFile, "rw");
File scndFile = new File("mnt/external_sd/Android/data/com.example.storagetest", "test2.txt");
scndFile.createNewFile();
我得到一个错误如下:
打开失败:EACCES(拒绝)
当前的AndroidManifest.xml
<application>
...
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
我试过很多不同的方式... requestPermissions() and android:maxSdkVersion不会改变任何东西 太多的搜索,但我无法得出结论。
如何在SD卡上创建文件。
重要提示:我可以直接读取文件,但不能更改或创建新文件。
它是否改变任何根访问?我正在阅读博客,我很快就会确认, – Abdullah
@Abdullah:根访问权应该允许您使用可移动媒体。此外,系统应用程序(至少是预先安装的系统应用程序)可以由设备制造商授予可移动介质的权限(或者,可能是定制ROM开发人员)。但是,普通的SDK应用程序不能。如果您对这些问题感兴趣,您可以考虑阅读[Dave Smith的博客文章](https://possiblemobile.com/2014/03/android-external-storage/)了解如何实施的细节。 – CommonsWare