-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coil 3.0.0 R8 missing classes detected #2637
Comments
+1. Additionally, I also get this:
So I don't think Per the docs, my application class is like so: @HiltAndroidApp
MyApplication: Application(), Configuration.Provider, SingletonImageLoader.Factory {
…
@OptIn(ExperimentalCoilApi::class)
override fun newImageLoader(context: PlatformContext) = ImageLoader.Builder(context)
.components {
add(OkHttpNetworkFetcherFactory(cacheStrategy = { CacheControlCacheStrategy() }))
}.build()
} |
@adhirajsinghchauhan You are right. After adding
Forgot to meantion that we also have this code in our Application class: @HiltAndroidApp
class MyApp : Application(), SingletonImageLoader.Factory, Configuration.Provider {
…
@OptIn(ExperimentalCoilApi::class)
override fun newImageLoader(context: PlatformContext): ImageLoader {
return ImageLoader.Builder(this)
.components {
add(OkHttpNetworkFetcherFactory(cacheStrategy = { CacheControlCacheStrategy() }))
add(SvgDecoder.Factory())
add(VideoFrameDecoder.Factory())
}
.logger(
object : Logger {
override var minLevel: Level = Level.Verbose
override fun log(
tag: String,
level: Level,
message: String?,
throwable: Throwable?
) {
logVerbose("COIL") { message.toString() }
}
}
)
.build()
} |
Hmm we had another report of R8 issues here, but I haven't been able to repro it locally. Missing Do you use any special R8 config or hardcoded R8 version? As a work-around you could try:
|
@adhirajsinghchauhan Inspecting the JAR indicates |
I'm also having issues with the
The |
Same issue, images are not loading in debug build and debug logger saying
Removing the custom fetcher factory resolves the issue, without following block it loads images properly
|
Be wary though, as this is must be provided if your use-case requires respecting I imagine anything that relies on |
I tried this, but it didn't work. |
Ofcourse, postponing migration to 3.0.0 for now as I require |
Does anyone have a way to reproduce this issue locally? Referencing |
I've created a repository with detailed commits, for my issue with the debug build. Haven't tried a release build: https://github.com/JanMalch/coil3bug As @lmiskovic mentioned, it only occurs after adding a connectivityChecker = { ctx -> ConnectivityChecker(ctx) } It seems that even an explicit |
@JanMalch Thanks for the repro project! I'm able to reproduce the error locally. It seems like there's some kind issue with the code generated for this function specifically: fun OkHttpNetworkFetcherFactory(
callFactory: () -> Call.Factory = ::OkHttpClient,
cacheStrategy: () -> CacheStrategy = { CacheStrategy.DEFAULT },
connectivityChecker: (PlatformContext) -> ConnectivityChecker = ::ConnectivityChecker,
) Hopefully we can work around the generated code issue. For now folks can use your work around. |
This is working. But we still get the R8 error for release builds:
When I build with |
@colinrtwhite I switched to add(OkHttpNetworkFetcherFactory(cacheStrategy = { CacheControlCacheStrategy() })) The release builds does not show any R8 errors anymore and images are loading (so no runtime errors). Looks like your changes fixed the issue! 🎊 |
Awesome, thanks for checking! Will ship this in |
Describe the bug
After switching to Coil 3.0.0 the R8 task fails with the following error:
The
missing_rules.txt.
contains-dontwarn coil3.PlatformContext
. So maybe this should just be shipped as a consumer R8/ProGuard rule?To Reproduce
Migrate to Coil 3.0, try to build minified Android app.
Version
Coil 3.0.0, AGP 8.7.2
The text was updated successfully, but these errors were encountered: