Android模拟器SD卡突然只读(未安装?)模拟器、突然、Android、SD

2023-09-05 03:42:21 作者:渡劫。

我一直在使用Android模拟器用了几个星期已安装SD卡,现在没有问题。今天,我开始了我的应用程序,它崩溃了NullPointerException异常时,我的活动尝试访问到/ mnt / SD卡。我检查DDMS文件浏览器,并到/ mnt / SD卡似乎是空的。我尝试将文件推到它,但它只读,权限是d ---------。有这两条线在logcat的输出的开头:

I've been using the android emulator with a mounted sdcard for a couple weeks now with no problem. Today I start my app and it crashes with a NullPointerException when my activity tries to access /mnt/sdcard. I check the DDMS file explorer and /mnt/sdcard seems to be empty. I try to push a file onto it but it's read-only, permissions are d---------. There are these two lines at the beginning of the logcat output:

D/Vold    (   29): Volume sdcard state changing -1 (Initializing) -> 0 (No-Media)
D/Vold    (   29): Volume sdcard state changing 0 (No-Media) -> 1 (Idle-Unmounted)

所以我把它的意思是sdcard.img突然没有安装出于某种原因。任何想法,为什么这将是?

So I take it to mean that sdcard.img is suddenly failing to mount for some reason. Any ideas why this would be?

推荐答案

打开一个shell到模拟器

Open up a shell to the emulator

adb shell

然后键入以下命令:

Then type the following command:

mount -o remount,rw /sdcard

现在行了?