1 问题
在sdcard目录下面创建了一个文件提示下面的错误
android.system.ErrnoException: open failed: ENOENT (No such file or directory)
2 分析
错误代码是如下
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
try {
File dir = new File(path + "/***/***/***/");
if (!dir.exists()) {
dir.mkdir();
}
File file = new File(path + "/***/***/***/", fileName);
if (file.exists()) {
return file;
}
if (file.createNewFile()) {
return file;
}
} catch (Exception e) {
return null;