Cache directory doesn't exist

2019-03-18 13:24发布


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

Thanks!

2条回答
forever°为你锁心
2楼-- · 2019-03-18 13:48

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.

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/" .

查看更多
成全新的幸福
3楼-- · 2019-03-18 14:04

Reading the thread posted at http://goo.gl/zipcZ it appears that an uninstall and re-install of the application resolves the issue in many cases. Additionally reading the thread, it does not appear that this is something you can fix as its an internal issue on some devices.

查看更多
登录 后发表回答