1
07-21 05:47:51.572: W/System.err(693): java.io.FileNotFoundException: /mnt/sdcard/file(Permission denied)

My code:

    private static final String savedRecords= 
        Environment.getExternalStorageDirectory().getPath() + "/file";

    Log.i(tag, "try enter");
    out = new BufferedOutputStream( new FileOutputStream(savedRecords));
    Log.i(tag, "write?");

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS"/>

over 6000 questions about "java.io.FileNotFoundException", but nothing including "Permission denied"

why is Permission denied, when is included in AndroidManifest.xml

Shailendra Madda
  • 20,649
  • 15
  • 100
  • 138
  • http://stackoverflow.com/questions/14475951/permission-denied-when-writting-into-sdcard – Ninad Pingale Jul 21 '14 at 06:21
  • 1
    If you're on 4.4, read here: http://www.androidcentral.com/kitkat-sdcard-changes Basically you can no longer read and write anywhere on the drive. – Gabe Sechan Jul 21 '14 at 06:22
  • @Gabe Sechan no i am able to read & write on 4.4 but I am unable to write in Gingerbread and i am using WRITE_EXTERNAL_STORAGE permission – Zeeshan Apr 06 '15 at 05:14

1 Answers1

0

did you use USB for debugging?

note that when you use USB for debugging, external storage is disabled.

thus,make sure that your device is in "Charge Only" mode. not in "Disk Drive" mode.

zelda
  • 33
  • 2
  • 9
  • not using debugging, just using run. target name: android 2.2 platform: 2.2 api level 8 cpu/abi: arm(armeabi) however usb for debugging rings a bell. is it a default setting in the emulator? – Michael Bridges Jul 21 '14 at 07:18