-1

the permission of my sdcard is Irwxrwxrwx i am unable to push any files in it Android Emulator sdcard push error: Read-only file system

how to change permission of DDMS / File Explorer / sdcard?

Change file permissions in DDMS (Android)

i have gone through many questions some of them have been posted above,they didn't help.. i even tried getting an image from a friend,with read/write permissions but that didn't help either.

Community
  • 1
  • 1
Ankit Srivastava
  • 280
  • 2
  • 7
  • 24

2 Answers2

0

Sometimes the problem comes for something simpler: my SD Card was FAT32 formated and this problem finished when I changed the filesystem to NTFS.

Sopalajo de Arrierez
  • 3,543
  • 4
  • 34
  • 52
-1

You first need to create an SD Card image. This can be done in the AVD Manager at the same time as creating the AVD image.

The SD Card image has to be mounted too (i.e. if you use an already mounted SD Card). When no card is mounted, /sdcard is treated as a folder of /system. So when you try to write to /sdcard on an AVD image without an SD Card mounted it tries to write to /system which is read-only.

Update: Make sure your SD card is mounted correctly. Use adb shell (or adb shell emulator-5554 when your real device is also plugged in) and enter df in the shell.

The output should look like this

Filesystem             Size   Used   Free   Blksize
/dev                   378M    32K   378M   4096
/mnt/asec              378M     0K   378M   4096
/mnt/obb               378M     0K   378M   4096
/system                194M   191M     2M   4096
/data                  194M     8M   185M   4096
/cache                  64M     1M    62M   4096
/mnt/sdcard            246M     6K   246M   512
/mnt/secure/asec       246M     6K   246M   512

Make sure that this two lines are present.

/mnt/sdcard            246M     6K   246M   512
/mnt/secure/asec       246M     6K   246M   512

This means, that the SD Card is mounted correctly.

That being said: DO NOT IN ANY CASES NEVER EVER USE HARDCODED /sdcard/... PATHES. Always use Envirnoment.getExternalStorageDevice() (for multi-user) or Environment.getExternalStoragePublicDirectory (String type) (for public folders accessible to all users)

For Clarification: The SD Card is mounted in a different physical path depending on manufacturer of the ROM. Back when Android first appeared, all external cards where mounted by default in /sdcard since back then all devices had small internal memory and SD-Card slots.

Newer Android Smartphones often ship without an SD Card. The newerones with 1-16 GB internal memory, like tablets, do not mount to /sdcard instead they mount by default to /mnt/sdcard. But it also depends on vendors. One vendor use one way over the other way. Tablets w/o SD Card for example use part of the internal storage to mount to the old /sdcard for compatibility reasons. Always use the API to get the path to internal storage memory!

http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29

or

http://developer.android.com/reference/android/os/Environment.html#getExternalStoragePublicDirectory%28java.lang.String%29

Tseng
  • 61,549
  • 15
  • 193
  • 205
  • what are you trying to say exactly?that one can create an avd along with specifying the size of sdcard,still may end up without the sdcard mounted? – Ankit Srivastava Aug 23 '13 at 13:38
  • Your question do not imply that you have created an SD card or that it's correctly mounted. Especially older images still have hardware feature list (i.e. `SD Card support: Yes`, `GPU supprt: Yes` etc.). – Tseng Aug 23 '13 at 13:50
  • it was a genuine question,(i wasn't mocking or something) i din't knew about the older versions – Ankit Srivastava Aug 23 '13 at 13:51
  • the last two lines are present – Ankit Srivastava Aug 23 '13 at 14:19
  • I did not said the question was not genuine. Stop reading something into my comments that I never said. I said your question did not specifically mention that you created **and** mounted an SD Card to your AVD image. When asking a question be **as specific as possible**, write all what you have done and if that did worked or not. Only so you can get a quick and accurate answer. The less information you provide, the more people will have to *guess* what may cause the issue – Tseng Aug 23 '13 at 14:25
  • I have also added some more text as clarification why you shall **NEVER** use an hardcoded path in your Apps. This has a very very high chance to break on certain devices. You have to use the API to avoid this issues. From your question it's everything than clear **what** you did. Did you push a file to file with `adb push someFile /sdcard`? If you you will have first to see which is the correct mount point for your SD Card and push it to this path. Are you accessing it by the app? Or `adb install SomeApp.apk`? As you see your question is not very clear – Tseng Aug 23 '13 at 14:29
  • i am pushing file via DDMS – Ankit Srivastava Aug 23 '13 at 14:30