Android Emulator sdcard push error: Read-only file

2019-01-02 20:15发布

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?

20条回答
路过你的时光
2楼-- · 2019-01-02 20:21

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 :)

查看更多
荒废的爱情
3楼-- · 2019-01-02 20:23
  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

查看更多
若你有天会懂
4楼-- · 2019-01-02 20:25

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)

查看更多
像晚风撩人
5楼-- · 2019-01-02 20:26

mount -o remount, rw /sdcard

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

查看更多
呛了眼睛熬了心
6楼-- · 2019-01-02 20:27

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!

查看更多
看淡一切
7楼-- · 2019-01-02 20:27

Try this in a Terminal Emulator as root:

restorecon -v -R /data/media
查看更多
登录 后发表回答