chrisbanes / Android-BitmapCache

Android-BitmapCache is a specialised cache, for use with Android Bitmap objects.
834 stars 224 forks source link

java.lang.IllegalArgumentException: Disk Cache Location is not write-able #19

Closed bostone closed 11 years ago

bostone commented 11 years ago

I have this piece of code to init image cache

final BitmapLruCache.Builder builder = new BitmapLruCache.Builder(context.getApplicationContext());
        builder.setMemoryCacheEnabled(true).setMemoryCacheMaxSizeUsingHeapSize();
        builder.setDiskCacheEnabled(true).setDiskCacheLocation(cacheLocation)
                .setRecyclePolicy(RecyclePolicy.DISABLED);
        this.imageCache = builder.build();

Sometimes it fails at the last line which I think is wrong. It should just gracefully disable SD caching if the error is caught

Here's stack trace

java.lang.IllegalArgumentException: Disk Cache Location is not write-able
at uk.co.senab.bitmapcache.BitmapLruCache$Builder.isValidOptionsForDiskCache(BitmapLruCache.java:737)
at uk.co.senab.bitmapcache.BitmapLruCache$Builder.build(BitmapLruCache.java:614)