Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Coil 3.0: Images from the network aren't loading #2634

Closed
colinrtwhite opened this issue Nov 4, 2024 · 0 comments
Closed

Coil 3.0: Images from the network aren't loading #2634

colinrtwhite opened this issue Nov 4, 2024 · 0 comments

Comments

@colinrtwhite
Copy link
Member

colinrtwhite commented Nov 4, 2024

Opening this preemptively to catch incoming issue when upgrading from Coil 2.0 to 3.0. You need to add Coil 3.0's new network dependency:

implementation("io.coil-kt.coil3:coil-network-okhttp:3.0.0")

This change was made for two reasons:

  • Coil now supports multiple networking libraries. You can use OkHttp on JVM/Android and Ktor if you need multiplatform support.
  • Coil no longer has a hard dependency on OkHttp so you don't have to import it if you only load images from local sources (file system, content providers, resources, etc.)

If you set a custom OkHttpClient it can be done like so:

val imageLoader = ImageLoader.Builder(context)
    .components {
        add(
            OkHttpNetworkFetcherFactory(
                callFactory = {
                    OkHttpClient()
                }
            )
        )
    }
    .build()
@colinrtwhite colinrtwhite pinned this issue Nov 4, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant