无法在 Android 模拟器中写入 sdcard [英] Cannot Write to sdcard in Android emulator

查看:27
本文介绍了无法在 Android 模拟器中写入 sdcard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 AndroidManifest.xml 中添加了这一行:

I have added this line in the AndroidManifest.xml:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

但是,当我运行代码写入 sdcard 时,出现此错误:

However, when I run code to write to the sdcard , I get this Error:

02-19 13:24:46.760: E/CameraTest(598): /mnt/sdcard/image.jpg: open failed: EACCES (Permission denied)

我该如何解决这个问题?

How do I solve this problem?

我正在使用添加了 SDCard 的 Android 模拟器.

I am using the Android Emulator with SDCard added.

EDIT-2:我知道现在的问题是什么:我调用了函数 Environment.getExternalStorageState() 并且我被删除"了.任何人都知道如何解决这个问题并使状态 MEDIA_MOUNTED

EDIT-2: I know what the problem is now: I have called the function Environment.getExternalStorageState() and I get "removed". Anyone knows how to fix this and make the state MEDIA_MOUNTED

谢谢!

推荐答案

好的,我已经解决了这个问题.这是我在安装 sdcard 时遇到的一个问题,而且 android 不允许路径中有空格!

Ok So I have solved this. It was a problem I faced with mounting the sdcard and that android doesn't allow spaces in the path!

以下是一个很好的程序(如果还使用了 eclipse):http://www.brighthub.com/mobile/google-android/articles/33240.aspx

Here is a good procedure to follow (if eclipse is also used) : http://www.brighthub.com/mobile/google-android/articles/33240.aspx

注意:如果路径中有空格,请将 sdcard 映像文件移动到其他位置,然后使用 sdcard 运行模拟器命令,一切都会正常!

NOTE: in case the path has a space in it, move the sdcard image file to somewhere else and then run the emulator command with the sdcard and everything should work fine!

这篇关于无法在 Android 模拟器中写入 sdcard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆