Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to create file - EACCESS Permission Denied
    text
    copied!<p>I'm writing some text into a file, yet before even writing the text, I am unable to create the file itself.</p> <pre><code>File newxmlfile = new File( Environment.getExternalStorageDirectory() + "new.xml"); XmlSerializer serializer = Xml.newSerializer(); try { newxmlfile.createNewFile(); } catch (Exception e) { Log.e("IOException", "exception in createNewFile() method", e); } </code></pre> <p>Permission is set fine.</p> <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre> <p>SDCard is writable and mounted also.</p> <p>However, I kept getting </p> <pre><code>07-11 11:23:01.134: E/IOException(5363): exception in createNewFile() method 07-11 11:23:01.134: E/IOException(5363): java.io.IOException: open failed: EACCES (Permission denied) 07-11 11:23:01.134: E/IOException(5363): at java.io.File.createNewFile(File.java:948) 07-11 11:23:01.134: E/IOException(5363): at com.app.example.MainActivity$LongOperation.doInBackground(MainActivity.java:71) 07-11 11:23:01.134: E/IOException(5363): at com.app.example.MainActivity$LongOperation.doInBackground(MainActivity.java:1) 07-11 11:23:01.134: E/IOException(5363): at android.os.AsyncTask$2.call(AsyncTask.java:287) 07-11 11:23:01.134: E/IOException(5363): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 07-11 11:23:01.134: E/IOException(5363): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 07-11 11:23:01.134: E/IOException(5363): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 07-11 11:23:01.134: E/IOException(5363): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 07-11 11:23:01.134: E/IOException(5363): at java.lang.Thread.run(Thread.java:856) 07-11 11:23:01.134: E/IOException(5363): Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied) 07-11 11:23:01.134: E/IOException(5363): at libcore.io.Posix.open(Native Method) 07-11 11:23:01.134: E/IOException(5363): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110) 07-11 11:23:01.134: E/IOException(5363): at java.io.File.createNewFile(File.java:941) 07-11 11:23:01.134: E/IOException(5363): ... 8 more 07-11 11:23:01.134: E/FileNotFoundException(5363): can't create FileOutputStream </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload