缓存目录不存在

fut*_*sta 13 android caching memory-management


context.getApplicationContext().getCacheDir()返回null怎么可能?据我所知,内部缓存目录应始终存在.

谢谢!

and*_*per 6

也许它会返回null,因为你没有足够的内部存储空间?尝试也使用getExternalCacheDir

此外,如果它不起作用,只需转到路径.

标准是它应该给你路径"/ data/data/YOUR_APP_PACKAGE_NAME/cache /",如果你想要外部存储缓存,它应该给你路径"EXTERNAL_STORAGE_PATH/Android/data/YOUR_APP_PACKAGE_NAME/cache /".