coil-kt / coil

Image loading for Android and Compose Multiplatform.
https://coil-kt.github.io/coil/
Apache License 2.0
10.86k stars 668 forks source link

RealImageLoader: java.lang.NoClassDefFoundError: okio.FileSystem #1270

Closed coreform closed 2 years ago

coreform commented 2 years ago

Describe the bug Trying to use coil for the first time, particularly to load svgs:

    implementation "io.coil-kt:coil:2.0.0"
    implementation "io.coil-kt:coil-svg:2.0.0"

Loading into a TextView background just to be different:

svgLoader = ImageLoader.Builder(context)
            .logger(DebugLogger())
            .components(fun ComponentRegistry.Builder.() {
                add(SvgDecoder.Factory())
            }).build()

To Reproduce See above.

Logs/Screenshots RealImageLoader: java.lang.NoClassDefFoundError: okio.FileSystem at coil.disk.DiskCache$Builder.<init>(DiskCache.kt:119) at coil.util.SingletonDiskCache.get(Utils.kt:278) at coil.ImageLoader$Builder$build$2.invoke(ImageLoader.kt:521) at coil.ImageLoader$Builder$build$2.invoke(ImageLoader.kt:521) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at coil.fetch.HttpUriFetcher.readFromDiskCache(HttpUriFetcher.kt:126) at coil.fetch.HttpUriFetcher.fetch(HttpUriFetcher.kt:39) at coil.intercept.EngineInterceptor.fetch(EngineInterceptor.kt:165) at coil.intercept.EngineInterceptor.execute(EngineInterceptor.kt:122) at coil.intercept.EngineInterceptor.access$execute(EngineInterceptor.kt:41) at coil.intercept.EngineInterceptor$intercept$2.invokeSuspend(EngineInterceptor.kt:75) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) Caused by: java.lang.NoSuchFieldError: No field Companion of type Lokio/ByteString$Companion; in class Lokio/ByteString; or its superclasses (declaration of 'okio.ByteString' appears in /data/app/~~c4MF59LpxUEg4jwWezxJiw==/packagenamewashere-HBvFTnmvN0sL7ZgbGoXorQ==/base.apk!classes12.dex) at okio.internal._PathKt.<clinit>(-Path.kt:26) at okio.internal._PathKt.commonToPath(Unknown Source:0) at okio.Path$Companion.get(Path.kt:118) at okio.Path$Companion.get$default(Path.kt:118) at okio.FileSystem.<clinit>(FileSystem.kt:143) at coil.disk.DiskCache$Builder.<init>(DiskCache.kt:119)  at coil.util.SingletonDiskCache.get(Utils.kt:278)  at coil.ImageLoader$Builder$build$2.invoke(ImageLoader.kt:521)  at coil.ImageLoader$Builder$build$2.invoke(ImageLoader.kt:521)  at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)  at coil.fetch.HttpUriFetcher.readFromDiskCache(HttpUriFetcher.kt:126)  at coil.fetch.HttpUriFetcher.fetch(HttpUriFetcher.kt:39)  at coil.intercept.EngineInterceptor.fetch(EngineInterceptor.kt:165)  at coil.intercept.EngineInterceptor.execute(EngineInterceptor.kt:122)  at coil.intercept.EngineInterceptor.access$execute(EngineInterceptor.kt:41)  at coil.intercept.EngineInterceptor$intercept$2.invokeSuspend(EngineInterceptor.kt:75)  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)  at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)  at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) 

Version 2.0.0

colinrtwhite commented 2 years ago

Please ask usage questions in Github Discussions.