patrickfav / Dali

Dali is an image blur library for Android. It contains several modules for static blurring, live blurring and animations.
https://favr.dev/opensource/dali
Apache License 2.0
1.05k stars 89 forks source link

Failed resolution of: Lcom/jakewharton/disklrucache/DiskLruCache; #15

Open MarkNjunge opened 5 years ago

MarkNjunge commented 5 years ago

Might be related to #14

Code

Dali.create(this).load(R.drawable.ic_launcher_background).blurRadius(10).into(imgBackground)

Stacktrace

2019-07-26 16:55:46.462 31292-31292/com.marknjunge.blurryshadow E/BlurBuilder: Could not set into imageview
    at.favre.lib.dali.builder.exception.BlurWorkerException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/jakewharton/disklrucache/DiskLruCache;
        at at.favre.lib.dali.builder.blur.BlurWorker.process(BlurWorker.java:153)
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:48)
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:27)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/jakewharton/disklrucache/DiskLruCache;
        at at.favre.lib.dali.builder.TwoLevelCache.getDiskCache(TwoLevelCache.java:72)
        at at.favre.lib.dali.builder.TwoLevelCache.getFromDiskCache(TwoLevelCache.java:147)
        at at.favre.lib.dali.builder.TwoLevelCache.get(TwoLevelCache.java:97)
        at at.favre.lib.dali.builder.blur.BlurWorker.process(BlurWorker.java:73)
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:48) 
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:27) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.jakewharton.disklrucache.DiskLruCache" on path: DexPathList[[zip file "/data/app/com.marknjunge.blurryshadow-Vc6sW-Lf0gDW7QCdqIz8GA==/base.apk"],nativeLibraryDirectories=[/data/app/com.marknjunge.blurryshadow-Vc6sW-Lf0gDW7QCdqIz8GA==/lib/arm, /data/app/com.marknjunge.blurryshadow-Vc6sW-Lf0gDW7QCdqIz8GA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:169)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at at.favre.lib.dali.builder.TwoLevelCache.getDiskCache(TwoLevelCache.java:72) 
        at at.favre.lib.dali.builder.TwoLevelCache.getFromDiskCache(TwoLevelCache.java:147) 
        at at.favre.lib.dali.builder.TwoLevelCache.get(TwoLevelCache.java:97) 
        at at.favre.lib.dali.builder.blur.BlurWorker.process(BlurWorker.java:73) 
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:48) 
        at at.favre.lib.dali.builder.blur.BlurWorker.call(BlurWorker.java:27) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
patrickfav commented 5 years ago

Maybe proguard removed these classes for you, can you check that your config is correct?

MarkNjunge commented 5 years ago

Proguard wasn't active.

patrickfav commented 5 years ago

This is probably an issue with a newer version of the build tools, as I am currently not an android dev in my professional career I do not follow the latest updates. Any update from somebody else is welcome.

diegor2 commented 4 years ago

As a workaround you can add the dependency manually to build.gradle

implementation 'com.jakewharton:disklrucache:2.0.2'

patrickfav commented 4 years ago

Since I cannot reproduce this locally, making me think this is specific to your build setup, could you please try v0.4.0 since it was migrated to AndroidX, and maybe jetify broke this for us?

diegor2 commented 4 years ago

For me it's working fine with Dali 0.4.0 Thanks!