开发者

Android+Eclipse: Can't push files to SD Card [duplicate]

This question already has answers here: Android Emulator sdcard push error: Read-only file system (20 answers) Closed 9 years ago.

Trying to push files to sd card via eclipse.

When I pull up my DDMS view, I have 3 main directories on the device:

/data
/mnt
/system

The only SDcard folder is located at /mnt/sdcard and it has permissions d--------.

I can't push anything to it, with the error:

Failed to push selection: Read-only file system

I had deleted and remade the device many times, with many different SD Card sized. I've tried adb remount at the adb shell as well as chmod 777 on the folder.

Why is this so difficult? Please help if you can.


rootfs / rootfs ro 0 0 t开发者_StackOverflow社区mpfs /dev tmpfs rw,nosuid,mode=755 0 0 
devpts /dev/pts devpts rw,mode=600 0 0 proc /proc proc rw 0 0 
sysfs /sys sysfs rw 0 0 none /acct cgroup rw,cpuacct 0 0 
tmpfs /mnt/asec tmpfs rw,mode=755,gid=1000 0 0 
tmpfs /mnt/obb tmpfs rw,mode=755,gid=1000 0 0 
none /dev/cpuctl cgroup rw,cpu 0 0
/dev/block/mtdblock0 /system yaffs2 ro 0 0 
/dev/block/mtdblock1 /data yaffs2 rw,nosuid,nodev 0 0
/dev/block/mtdblock2 /cache yaffs2 rw,nosuid,nodev 0 0 


I had the same problem, and it seems that it's impossible to mount sdcard on emulator using API Level 10. I don't know if it's an android-sdk problem or Eclipse problem, but that's it. It's possible to mount sdcard on emulators with API 7(2.1), 8(2.2) and 15(4.0.3). By the way, mounting sdcard on API 7,8,15 is a bit buggy too. I had to launch each emulator 3 times before I managed to mount sdcard: 1st and 2nd launch - not mounted, 3rd launch - mounted!


Your device is most likely in "USB Mass Storage" mode and will not let you access the SDCard file system from Eclipse or adb. To fix this, set the USB mode to "Charge Only" or, in some cases, "PC Mode" might work. Depending on your device, you can usually configure this mode by dragging down the notification bar at the top of the screen and clicking on "USB Connection".


If you are using eclipse Window > AVD Manager > [Select your device] > Edit

SD Card: Enter some value Eg:512 MiB

Should work


In the above post the list of mounts have been shown, in which no mount to sdcard is there. In the DDMS the list of permissions for sdcard is shown as d-------- Anyways, the problem for me was solved once I deleted the emulator and created new one.


I hope you know this and done this too.... you will need to give your app the correct permission to write to the SD Card by adding the line below to your Manifest:

uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" 


make sure that you pushing the file to your emulator from the left menu (devices) list in DDMB and not to your actually physical device.


I had the exact same problem and did 2 things that solved it (I don't know exactly which one did it!):

1) In DDMS view, click on the little arrow on the top right of the devices window and click reset adb :

Android+Eclipse: Can't push files to SD Card [duplicate]

2) Do the instructions provided by the accepted answer to this question:

Problem Pushing Large File to Emulator/SDcard with Eclipse DDMS


I highly suspect the second one did it. But I'm not sure.

Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜