title: FIleNotFound open failed: EACCES (Permission denied)
body: <p>I am suffering from an "open failed: EACCES (Permission denied)" on Android when I attempt to write to "/mnt/sdcard/report/". My 1st step is to create the "report" folder which doesn't work. I then attempt to write which throws the above exception. I have set <code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;</code> as a peer (outside of) the application tag. I am trying to run a JUnit instrumentation test on the emulator when I get the error. Any ideas? Code is below. </p>
  
  <pre><code>        if (mReportDir == null) {
              if (mContext.getFilesDir() != null) {
                  mOutputStream = mContext.openFileOutput(fileName, 0);
              } else {
                  mOutputStream = mTargetContext.openFileOutput(fileName, 0);
              }
          } else {
              File f = new File(mReportDir);
              if (!f.exists()) {
                  f.mkdirs();
              }
              mOutputStream = new FileOutputStream(new File(mReportDir, fileName));
          }
  </code></pre>
  
  <p>mReportDir is equal to "/mnt/sdcard/report", fileName is equal to "junit-report.xml", f.mkdirs returns false I believe and the dir is never created. I'm wondering why I get permission denied. I'm trying to reuse a custom JUnit Test runner.</p>
  
  <p>I've added hw.sdCard= yes to the avd settings. After launching I shell in and type mount:</p>
  
  <pre><code>~$ adb shell
  # mount
  rootfs / rootfs ro 0 0
  tmpfs /dev tmpfs rw,nosuid,mode=755 0 0
  devpts /dev/pts devpts rw,mode=600 0 0
  proc /proc proc rw 0 0
  sysfs /sys sysfs rw 0 0
  none /acct cgroup rw,cpuacct 0 0
  tmpfs /mnt/asec tmpfs rw,mode=755,gid=1000 0 0
  tmpfs /mnt/obb tmpfs rw,mode=755,gid=1000 0 0
  none /dev/cpuctl cgroup rw,cpu 0 0
  /dev/block/mtdblock0 /system yaffs2 ro 0 0
  /dev/block/mtdblock1 /data yaffs2 rw,nosuid,nodev 0 0
  /dev/block/mtdblock2 /cache yaffs2 rw,nosuid,nodev 0 0
  </code></pre>
  
  <p>Again, I am launching the AVD programmatically from an Ant script. Is there something I can do programmatically to mount the sdcard?</p>