Android:无法从设备访问 SD 卡文件

发布于 2024-12-22 14:42:26 字数 329 浏览 3 评论 0原文

我正在开发一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

痴者 2024-12-29 14:42:26

确保您没有在“磁盘驱动器”模式下将手机连接到电脑。

Make sure you didn't connect the phone to your PC in "disk drive" mode.

漫漫岁月 2024-12-29 14:42:26

我记得为了能够使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文