getExternalFilesDir()返回null(没有权限问题) [英] getExternalFilesDir() returns null (not a permissions issue)

查看:606
本文介绍了getExternalFilesDir()返回null(没有权限问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经工作了一段时间的应用程序,并一直在测试它在许多设备上。突然,它停止工作的摩托罗拉Xoom家庭版(蜂窝3.1)。每一次我想尝试运行应用程序,它会失败的调用getExternalFilesDir(),因为该调用将返回一个空文件代替。

I've been working on an app for some time, and have been testing it on many devices. Suddenly, it stopped working on the Motorola Xoom Family Edition (Honeycomb 3.1). Every time I would try to run the app, it would fail on the call to getExternalFilesDir(), as that call would return null instead of a File.

从我的研究,任何人只要有一个类似的问题,要么是缺少WRITE_EXTERNAL_STORAG​​E,没有得到回答,或者是在谈论升级Froyo的错误。这些方法都适用于这里 - 并再次,它工作正常,在其他设备上,我有WRITE_EXTERNAL_STORAG​​E权限,它甚至正在这个设备上,直到几分钟前

From my research, anyone with a similar problem is either missing the WRITE_EXTERNAL_STORAGE, never got an answer, or was talking about a bug in Froyo. None of that applies here--and again, it works fine on other devices, I have the WRITE_EXTERNAL_STORAGE permission, and it was even working on this device until a few minutes ago.

任何想法可能会导致此问题,或如何通过编程prevent呢?

Any idea what might cause this issue, or how to programmatically prevent it?

推荐答案

问题走了之后,我重新启动平板电脑。这可能只是一些奇怪的怪癖,是非常罕见的,固定由一个简单的重新启动;我希望不会,因为我想有一个坚实的方式prevent这个,而不是仅仅希望谁碰上了错误的任何用户都理解。

The problem went away after I restarted the tablet. It may just be some bizarre quirk that is extremely rare and fixed by a simple restart; I hope not, as I would like to have a solid way to prevent this instead of just hoping that any users who run into the bug are understanding.

这篇关于getExternalFilesDir()返回null(没有权限问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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