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

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.

查看更多
弹指情弦暗扣
3楼-- · 2019-01-02 20:28

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

查看更多
ら面具成の殇う
4楼-- · 2019-01-02 20:29

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

查看更多
皆成旧梦
5楼-- · 2019-01-02 20:29

Windows uses backward slashes, linux uses forward slashes.

查看更多
残风、尘缘若梦
6楼-- · 2019-01-02 20:31

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

查看更多
伤终究还是伤i
7楼-- · 2019-01-02 20:32

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

查看更多
登录 后发表回答