android cache 存储器,Android 获取 cache 目录失败 ContextImpl: Failed to ensure directory

Android 获取 cache 目录失败 ContextImpl: Failed to ensure directory

Android,cache,getExternalCacheDir失败,getCacheDir失败,getExternalCacheDir异常,Failed to ensure directory,

2016-03-23 03:16:04

在通过 context.getExternalCacheDir() 或者 context.getCacheDir() 类似的方法获取文件的时候,可能会报以下的错误:

ContextImpl: Failed to ensure directory: /storage/sdcard1/Android/data/com.binkery.allinone/cache

在 Stackoverflow 上找到的答案,基本可以忽略这个错误提示。

Answer 1 :

This happened to me when uninstalling the app and reinstalling it. But probably the resources of the app (com.xxxx.app in your case) had a reference not released.

The solution was quite simple: just stop and relaunch the emulator, or reboot the phone should do the trick.

这里解释获取 cache 目录失败的原因是卸载 app 并且重新安装的时候,某些 app 的资源因为没有释放没有被彻底删除掉,导致的失败。重启手机可以解决这样的问题。

另外吐槽一下小米手机,通过 adb 在小米手机上安装应用程序,经常会出现各种各样的安装失败。

Answer 2 :

This is because you are connected to your development machine, and cannot write to the emulated storage on it.

另外一种可能是你连接的设备是一个开发机,并且你不能写入文件到它的存储器中。这种一般比较少。

相关文章

- EOF -

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处,尊重他人劳动。

转载请注明:文章转载自 Binkery 技术博客 [https://binkery.com]

本文标题: Android 获取 cache 目录失败 ContextImpl: Failed to ensure directory

本文地址:https://binkery.com/archives/536.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值