Android:无法从设备访问 SD 卡文件
我正在开发一个 Android 应用程序,它可以从 SD 卡写入和读取 .PNG 文件。我已经在设备(htc)上尝试过它并且工作正常。然后我必须修改一些代码来纠正一些错误(请注意,所做的更改与保存/打开功能无关)。但现在就像这样我无法再在 SD 卡上保存/打开文件。
我尝试在 DDMS 文件资源管理器视图 (eclipse) 中打开 sdcard 文件夹,但它显示为空,并且权限为 d---------。我认为这与权限有关,但我不知道到底是什么导致了这个问题以及如何解决它。
为了查看问题是否出在我的应用程序中,我在模拟器上对其进行了测试,并且工作正常。所以问题肯定与设备有关。
有什么建议吗?
I'm working on an android app that writes and reads .PNG files from sdcard. I've already tried it on a device (htc) and it was working fine. Then I had to modify some code to correct some errors (Note that changes made had nothing to do with save/open function). But now just like that I can no longer save/open files on sdcard.
I've tried to open sdcard folder in DDMS File Explorer view (eclipse) but it appears empty and the permissions are d---------
. I think it has something to do with the permissions but I have no idea what exactly is causing this problem and how to solve it.
To see if the problem was in my app I tested it on an emulator and it's working fine. So the problem is definitely related to the device.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保您没有在“磁盘驱动器”模式下将手机连接到电脑。
Make sure you didn't connect the phone to your PC in "disk drive" mode.
我记得为了能够使用 ddms 查看某些目录的内容,您需要 root 手机才能获得权限。
I recall that in order to be able to view contents of certain directories with ddms you need to have rooted your phone to get the permissions.