Android+Eclipse:无法将文件推送到SD卡
尝试通过 eclipse 将文件推送到 SD 卡。
当我拉出 DDMS 视图时,设备上有 3 个主要目录:
/data
/mnt
/system
唯一的 SDcard 文件夹位于 /mnt/sdcard
并且具有权限 d------- -
。
我无法向其推送任何内容,并出现错误:
无法推送选择:只读 文件系统
我已经删除并重新制作了设备多次,并且使用了许多不同大小的 SD 卡。我尝试过在 adb shell 上执行 adb remount 以及在文件夹上执行 chmod 777 。
为什么这么难?如果可以的话请帮忙。
rootfs / rootfs ro 0 0 tmpfs /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
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 tmpfs /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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我遇到了同样的问题,似乎无法使用 API Level 10 在模拟器上安装 sdcard。我不知道这是 android-sdk 问题还是 Eclipse 问题,但就是这样。可以使用 API 7(2.1)、8(2.2) 和 15(4.0.3) 在模拟器上安装 SD 卡。顺便说一句,在 API 7、8、15 上安装 sdcard 也有一点问题。在成功安装 SD 卡之前,我必须启动每个模拟器 3 次:第一次和第二次启动 - 未安装,第三次启动 - 已安装!
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!
您的设备很可能处于“USB 海量存储”模式,并且不允许您从 Eclipse 或 adb 访问 SDCard 文件系统。要解决此问题,请将 USB 模式设置为“仅充电”,或者在某些情况下,“PC 模式”可能会起作用。根据您的设备,您通常可以通过向下拖动屏幕顶部的通知栏并单击“USB 连接”来配置此模式。
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".
如果您使用的是 eclipse
窗口> AVD管理器> [选择您的设备]>编辑
SD 卡:输入一些值 例如:512 MiB
应该可以
If you are using eclipse
Window > AVD Manager > [Select your device] > Edit
SD Card: Enter some value Eg:512 MiB
Should work
在上面的帖子中已经显示了挂载列表,其中没有挂载到 sdcard。在 DDMS 中,sdcard 的权限列表显示为 d-------- 不管怎样,一旦我删除了模拟器并创建了新的模拟器,我的问题就解决了。
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.
我希望你知道这一点并且也这样做了......
您需要将以下行添加到您的清单中,为您的应用程序授予写入 SD 卡的正确权限:
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:
确保从 DDMB 中的左侧菜单(设备)列表将文件推送到模拟器,而不是实际的物理设备。
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.
我遇到了完全相同的问题,并做了两件事解决了这个问题(我不知道到底是哪一件做的!):
1) 在 DDMS 视图中,单击右上角的小箭头设备窗口并单击
重置 adb
:2) 按照接受的答案提供的说明进行操作对于这个问题:
将大文件推送到模拟器/SD卡时出现问题使用 Eclipse DDMS
我高度怀疑第二个做到了。但我不确定。
希望有帮助。
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
: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.