코드를 찾았으며 응용 프로그램에 따라 약간 편집했습니다. 안드로이드에서 txt 텍스트를 바이트 단위로 쓰는 것입니다. 이 오류가 나타납니다. Exception 'open failed: EACCES (Permission denied)' on Android열기 실패 : Android에서 EACCES (권한 거부)
위의 링크에서 설명한 것처럼 write_external_storage와 관련된 사용자 권한이 Android Manifest 파일에있는 위치를 변경했습니다. 그러나 그 파일에서 "태그가 태그 뒤에 나타납니다"라는 경고가 나에게 다시 같은 오류가 발생하도록 안내합니다.
당신은 매니페스트<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
전에 응용 프로그램 태그에이 권한을 필요로 사전
if (response.equals("tag OK " + param[2]
+ " authenticated (Success)")) {
mySuccessfulLogin = param[0] + "\n"
+ param[1] + "\n" + param[2]
+ "\n" + newpassword;
myDirectory = Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+"Users/macbookpro/Documents/CS328/Android_IMAP";
File custdir = new File(myDirectory);
if(!custdir.exists())
{
custdir.mkdirs();
}
File savedir=new File(custdir.getAbsolutePath());
File file = new File(savedir, "LastLogin");
if(file.exists())
{
file.delete();
}
FileOutputStream fos;
byte[] data = mySuccessfulLogin.getBytes();
try {
fos = new FileOutputStream(file);
fos.write(data);
fos.flush();
fos.close();
// Toast.makeText(, "File Saved", Toast.LENGTH_LONG).show();
} catch (FileNotFoundException e) {
//Toast.makeText(getBaseContext(), "Error File Not Found", Toast.LENGTH_LONG).show();
Log.e("fnf", ""+e.getMessage());
// handle exception
} catch (IOException e) {
// handle exception
// Toast.makeText(getBaseContext(), "Error IO Exception", Toast.LENGTH_LONG).show();
}
}
로그 게시하시기 바랍니다 – Lukos