我的 sdcard 的权限是 Irwxrwxrwx 我无法在其中推送任何文件 Android Emulator sdcard push error: Read-only file system
如何更改 DDMS / 文件资源管理器 / sdcard 的权限?
我经历了很多问题,其中一些问题已在上面发布,但没有帮助.. 我什至尝试从朋友那里获取具有读/写权限的图像,但这也无济于事。
我的 sdcard 的权限是 Irwxrwxrwx 我无法在其中推送任何文件 Android Emulator sdcard push error: Read-only file system
如何更改 DDMS / 文件资源管理器 / sdcard 的权限?
我经历了很多问题,其中一些问题已在上面发布,但没有帮助.. 我什至尝试从朋友那里获取具有读/写权限的图像,但这也无济于事。
有时问题出在更简单的问题上:我的 SD 卡是 FAT32 格式,当我将文件系统更改为 NTFS 时,这个问题就解决了。
You first need to create an SD Card image. This can be done in the AVD Manager at the same time as creating the AVD image.
The SD Card image has to be mounted too (i.e. if you use an already mounted SD Card). When no card is mounted, /sdcard
is treated as a folder of /system
. So when you try to write to /sdcard on an AVD image without an SD Card mounted it tries to write to /system
which is read-only.
Update:
Make sure your SD card is mounted correctly. Use adb shell
(or adb shell emulator-5554
when your real device is also plugged in) and enter df
in the shell.
The output should look like this
Filesystem Size Used Free Blksize
/dev 378M 32K 378M 4096
/mnt/asec 378M 0K 378M 4096
/mnt/obb 378M 0K 378M 4096
/system 194M 191M 2M 4096
/data 194M 8M 185M 4096
/cache 64M 1M 62M 4096
/mnt/sdcard 246M 6K 246M 512
/mnt/secure/asec 246M 6K 246M 512
Make sure that this two lines are present.
/mnt/sdcard 246M 6K 246M 512
/mnt/secure/asec 246M 6K 246M 512
This means, that the SD Card is mounted correctly.
That being said: DO NOT IN ANY CASES NEVER EVER USE HARDCODED /sdcard/... PATHES. Always use Envirnoment.getExternalStorageDevice()
(for multi-user) or Environment.getExternalStoragePublicDirectory (String type)
(for public folders accessible to all users)
For Clarification: The SD Card is mounted in a different physical path depending on manufacturer of the ROM. Back when Android first appeared, all external cards where mounted by default in /sdcard
since back then all devices had small internal memory and SD-Card slots.
Newer Android Smartphones often ship without an SD Card. The newerones with 1-16 GB internal memory, like tablets, do not mount to /sdcard
instead they mount by default to /mnt/sdcard
. But it also depends on vendors. One vendor use one way over the other way. Tablets w/o SD Card for example use part of the internal storage to mount to the old /sdcard
for compatibility reasons. Always use the API to get the path to internal storage memory!
http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory%28%29
or