context.getApplicationContext().getCacheDir()
怎么可能返回 null
?据我所知,内部缓存目录应该始终存在。
谢谢!
最佳答案
也许它返回 null 因为您没有足够的内部存储空间?尝试也使用 getExternalCacheDir
另外,如果它不起作用,只需转到路径即可。
标准是它应该给你路径“/data/data/YOUR_APP_PACKAGE_NAME/cache/”,如果你想要外部存储缓存,它应该给你路径“EXTERNAL_STORAGE_PATH/Android/data/YOUR_APP_PACKAGE_NAME/cache/”。
关于android - 缓存目录不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4441849/