Android Emulator sdcard push error: Read-only file system

Android Emulator

Android Emulator Problem Overview


I am developing under Android 1.6 (Android SDK 2.1). I create a avd by using avd manager in Eclipse. When I launch this avd, I found that the /sdcard directory's permisson is "d---------". So I can't push file to the sdcard.

Does anyone know how to solve this problem?

Android Emulator Solutions


Solution 1 - Android Emulator

I found this works

$./adb shell
$su
mount -o rw,remount rootfs /
chmod 777 /mnt/sdcard
exit

Source: http://www.coderanch.com/t/611842/Android/Mobile/Android-emulator-sdcard-writable

Solution 2 - Android Emulator

Once you started the Emulator from one shell, login to another shell & type

adb shell

You should see # prompt displayed, this is your device(emulator) shell. Now , type following command at adb shell.

mount -o remount rw /sdcard

This will now remount /sdcard with rw(read-write) permission & now you can push your files into /sdcard by using following command from your host shell.

`adb push filename.mp3 /sdcard,`

where filename.mp3 could be any file that you want to push into Android Emulator.

Hope this helps :)

Solution 3 - Android Emulator

Ensure two things in the AVD manager utility for the emulator:

  1. SD Card size is mentioned e.g. 512.

  2. From the Hardware tag, press New and select "SD Card Support" from the drop down menu.

Now, start the emulator. SD Card shall now support writing as well.

Solution 4 - Android Emulator

Android studio version 0.8.9 and above has a bug creating AVDs.

See Issue 78434.

Workaround

  • go to your ADV folder in .android folder and find your AVD config.ini
  • open it with a text editor that can handle unix newlines. (Notepad will run the lines together since they don't have CR-LFs.)
  • change hw.sdCard=no to hw.sdCard=yes

this should work for everyone in new builds

Solution 5 - Android Emulator

Maybe it sounds stupid but it worked for me when I had the same problem: delete the created avd and create one again through AVD Manager with a sd card of, for example, 512MB.

Check that both have the correct permissions and if not, try to change them with chmod.

And if everything still fails, repeat the process but creating both avd and sd card manually via terminal:

android create avd -n my_avd -t 7
mksdcard -l e 512M mysdcard.img
emulator -avd my_avd -sdcard mysdcard.img

Hope that helps!

Solution 6 - Android Emulator

I think the problem here is that you forgot to set SD card size

Follow these steps to make it work:

  1. step1: close running emulator
  2. step2: open Android Virtual Device Manager(eclipse menu bar)
  3. step3: choose your emulator -> Edit -> then set SD card size

This works well in my emulator!

Solution 7 - Android Emulator

Make sure that you had given a value which is greater than zero for SD Card size in the Create AVD Window for that particular emulator.

Solution 8 - Android Emulator

mount -o remount, rw /sdcard

this is the correct way to remount your sdcard using your emulator.

Solution 9 - Android Emulator

I tried @user2002993 great help but it one place it need to be a little edit so I edited and here what worked for me on Android Studio, emulator android 5.

Go to your adb folder right click on blank area and select "open command window here" or if you installed adb by adb-installer open cmd and type these commands:

adb devices

It should show your emulator number and detail. Then followed command here:

adb shell

Now it should show you prompt #

su

mount -o rw,remount rootfs

chmod 777 /mnt/sdcard

exit

exit

Yeah double exit needed, now your prompt of adb shell is gone. Put a file in to your adb folder and give this command and see if it got fixed.

adb push "your file name like : 1.jpg" /sdcard/

or

adb push "your file name like : 1.jpg" /storage/sdcard/

Now in cmd it shoudl show you transfer time instead of creepy read-only thing 

Solution 10 - Android Emulator

I increased the virtual memory of sdcard up to 512 MB for the emulator and that was enough

Solution 11 - Android Emulator

I guess, you didn't insert memory size at the time of creating avd. you can do that by editing the avd. screenshot

Solution 12 - Android Emulator

make sure that you have the correct permissions.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

Solution 13 - Android Emulator

Windows uses backward slashes, linux uses forward slashes.

Solution 14 - Android Emulator

sometimes this can cause of a very simple reason, go to your list in eclipse and check whether you have set SDCard size

Solution 15 - Android Emulator

I had this problem on Android L developer preview, and, at least for this version, I solved it by creating an sdcard with a size that had square 2 size (e.g 128M, 256M etc)

Solution 16 - Android Emulator

In adb version 1.0.32 and Eclipse Luna (v 4.4.1).

I found a directory in the avd /mnt/media_rw/sdcard that you can write to using the adb command. adb push {source} /mnt/media_rw/sdcard

There appears to be rw access to this directory.

Hope this helps :-)

Solution 17 - Android Emulator

Alternate way: Dismount the drive (from settings/storage) and re-mount the sdcard also fixes the problem. (verify by moving a file from internal storage to sdcard) In any case, this simple method saved my butt this time :)

Solution 18 - Android Emulator

  1. Give any size to Sdcard in Emulator
  2. unchecked the read only option from c:\user...android\avd -> properties
  3. push a file through file explorer
  4. restart the Emulator

It will definitely works

Solution 19 - Android Emulator

With me in the end helped In the emulator to run applications manager and setting permissions for storage.

Solution 20 - Android Emulator

Try this in a Terminal Emulator as root:

restorecon -v -R /data/media

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLeoxView Question on Stackoverflow
Solution 1 - Android Emulatoruser2002993View Answer on Stackoverflow
Solution 2 - Android EmulatorashutoshView Answer on Stackoverflow
Solution 3 - Android EmulatorSumitView Answer on Stackoverflow
Solution 4 - Android Emulatorafra mehrparvarView Answer on Stackoverflow
Solution 5 - Android EmulatorEdu ZamoraView Answer on Stackoverflow
Solution 6 - Android EmulatortanView Answer on Stackoverflow
Solution 7 - Android EmulatorDipinView Answer on Stackoverflow
Solution 8 - Android EmulatorteddyView Answer on Stackoverflow
Solution 9 - Android Emulatorafra mehrparvarView Answer on Stackoverflow
Solution 10 - Android Emulatoruser2604908View Answer on Stackoverflow
Solution 11 - Android EmulatorSuresh SharmaView Answer on Stackoverflow
Solution 12 - Android EmulatoresseView Answer on Stackoverflow
Solution 13 - Android EmulatornomappView Answer on Stackoverflow
Solution 14 - Android Emulatoruser1347778View Answer on Stackoverflow
Solution 15 - Android EmulatorEliView Answer on Stackoverflow
Solution 16 - Android EmulatorgregrobinzView Answer on Stackoverflow
Solution 17 - Android EmulatorRaymond FraikinView Answer on Stackoverflow
Solution 18 - Android EmulatorKamleshwer PurohitView Answer on Stackoverflow
Solution 19 - Android Emulatormomik bęcView Answer on Stackoverflow
Solution 20 - Android EmulatorintrepidisView Answer on Stackoverflow