Search code examples
androidstoragesd-card

Why is my SD Card not writable (Android)?


In the emulator I can't seem to write to the attached SDCard. The following code always spits out the "can't write root" log message, but not the "can't read root" one.

File routesRoot = Environment.getExternalStorageDirectory();
if (!routesRoot.canWrite())
    Log.v(getClass().getSimpleName(), "can't write root");
if (!routesRoot.canRead())
    Log.v(getClass().getSimpleName(), "can't read root");

Ideas?


Solution

  • Check, and then double check that you have the WRITE_EXTERNAL_STORAGE permission.