coil-kt / coil

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

Crash #312

Closed XtreeIvI closed 4 years ago

XtreeIvI commented 4 years ago

Describe the bug Crash while running code in Activity

                imageView.load(banner.image) {
                    crossfade(true)
                    placeholder(R.drawable.img_doctor_avatar_placeholder_offset)
                }

Maybe there is underlying libs conflict with forced dependencies?

Expected behavior Image Load

To Reproduce Just Run App

Logs/Screenshots java.lang.NoSuchFieldError: coil.decode.DecodeUtils coil.drawable.CrossfadeDrawable.updateBounds$coil_base_release(CrossfadeDrawable.kt:249) coil.drawable.CrossfadeDrawable.onBoundsChange(CrossfadeDrawable.kt:151) android.graphics.drawable.Drawable.setBounds(Drawable.java:173) android.widget.ImageView.configureBounds(ImageView.java:1116) android.widget.ImageView.updateDrawable(ImageView.java:898) android.widget.ImageView.setImageDrawable(ImageView.java:472) androidx.appcompat.widget.AppCompatImageView.setImageDrawable(AppCompatImageView.java:100) coil.target.ImageViewTarget.setDrawable(ImageViewTarget.kt:44) coil.target.ImageViewTarget.onError(ImageViewTarget.kt:27) coil.transition.CrossfadeTransition.transition(CrossfadeTransition.kt:41) coil.memory.PoolableTargetDelegate.error(TargetDelegate.kt:234) coil.RealImageLoader$execute$2$1$1.invokeSuspend(RealImageLoader.kt:251) kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) kotlinx.coroutines.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:313) kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:26) kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109) kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158) kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:54) kotlinx.coroutines.BuildersKt.launch(Unknown Source) kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47) kotlinx.coroutines.BuildersKt.launch$default(Unknown Source) coil.RealImageLoader$execute$2$1.invoke(RealImageLoader.kt:241) coil.RealImageLoader$execute$2$1.invoke(RealImageLoader.kt:90) kotlinx.coroutines.InvokeOnCompletion.invoke(JobSupport.kt:1385) kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1525) kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:322) kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:239) kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:902) kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:859) kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:824) kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:111) kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:55) android.os.Handler.handleCallback(Handler.java:815) android.os.Handler.dispatchMessage(Handler.java:104) android.os.Looper.loop(Looper.java:207) android.app.ActivityThread.main(ActivityThread.java:5697) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)

Version 0.9.5

colinrtwhite commented 4 years ago

java.lang.NoSuchFieldError: coil.decode.DecodeUtils seems like it might be an R8 shrinking issue. I'd take a look at your shrinking rules.

XtreeIvI commented 4 years ago

there were an internal lib conflict

scottyab commented 3 years ago

I also ran into this java.lang.NoSuchFieldError: coil.decode.DecodeUtils issue. It was because we were forcing and older incompatible version of Okio 1.17.2. We mistakenly thought we needed to as part of ensuring okHttp was 3.14.9 (needed for Retrofit). Changing okio version to 2.10.0 fixed the issue.