gpt4 book ai didi

android - 使用 getCacheDir 时文件在哪里

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:26:15 25 4
gpt4 key购买 nike

当我调试时,我发现 GetCacheDir 返回 /data/data/yourapp/cache/

但是当我存储文件时,我在该路径中没有发现任何东西(使用 shell),但是在 /sdcard/Android/data/yourapp/cache/ 我找到了缓存文件?谁能告诉我为什么?

最佳答案

As I debugged, I found that the GetCacheDir return /data/data/yourapp/cache/

这听起来适合 getCacheDir .

But as I store files, I found nothing in that path(with shell), but in /sdcard/Android/data/yourapp/cache/ I found the cache file? who can tell me why?

这就是您从 getExternalCacheDir 得到的结果.

您确定您使用的是正确的 API 调用吗?您是否检查了文件操作的返回值(它们是否都成功)?您可以尝试一些文件功能来检查是否正常工作。 (createNewFile, exists, getAbsolutePath)

关于android - 使用 getCacheDir 时文件在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4957094/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com