缓存目录不存在 [英] Cache directory doesn't exist

查看:479
本文介绍了缓存目录不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


怎么可能是 context.getApplicationContext()。getCacheDir()返回?据我所知内部缓存目录应该一直存在。


how is it possible that context.getApplicationContext().getCacheDir() returns null? As far as I know the internal cache directory should always exist.

谢谢!

推荐答案

也许是因为你没有足够的内部存储返回null?尝试同时使用 getExternalCacheDir

maybe it returns null since you don't have enough internal storage? try to also use getExternalCacheDir

另外,如果它不工作,只需访问路径。

also , if it doesn't work , simply go to the path.

标准是,它应该给你的路径/数据/数据​​/ YOUR_APP_PACKAGE_NAME /缓存/,如果你想在外部存储高速缓存,它应该给你的路EXTERNAL_STORAG​​E_PATH /安卓/数据/ YOUR_APP_PACKAGE_NAME /缓存/。

the standard is that it should give you the path "/data/data/YOUR_APP_PACKAGE_NAME/cache/" , and if you want the external storage cache , it should give you the path "EXTERNAL_STORAGE_PATH/Android/data/YOUR_APP_PACKAGE_NAME/cache/" .

这篇关于缓存目录不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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