Android: open failed: ENOENT (No such file or directory)
今天在录音时.发现有些手机报这个错.发下5.0以上系统在写文件时.必须保证父目录都在
解决方案:
File pathToSave = new File(App.getInstance().getUserWorkSpace().getAudioDir(), sb.toString());
if (!pathToSave.getParentFile().exists()) {//必须创建父目录 ,不能直接将语音输出至该文件. 5.0以上机型报错
pathToSave.getParentFile().mkdirs();
}