Unresolved reference: compose in "coil.compose.AsyncImage"
Asked Answered
P

2

6

I am trying to import the coil image library inside a composable function using import coil.compose.AsyncImage and implementation("io.coil-kt:coil:2.2.2") but Android Studio can't recognize the 'compose' and returns

Unresolved reference: compose

I tried to invalidate the caches and clean the project with no change happened I use Android Studio Dolphin | 2021.3.1 where:

compose_ui_version = '1.2.1'

composeOptions {
    kotlinCompilerExtensionVersion '1.3.1'
}

compileSdk 33
gradle 7.4
Pragmatics answered 13/10, 2022 at 7:11 Comment(4)
Did you add implementation("io.coil-kt:coil-compose:2.2.2") in your app/build.gradle?Starfish
Yes I did implement @GabrieleMariottiPragmatics
I'm having this issue as well. Did you find a solution?Untried
@MartyMiller I used Android Studio Electric Eel instead of Dolphin with the same SDK and the error was gone. I don't know why. Of course, it's not a solution but I guess it's an issue with the IDEPragmatics
D
5

To use coil library with jetback compose you gotta use the coil-compose dependency.

In your build.gradle

change this implementation("io.coil-kt:coil:2.2.2")

to this implementation("io.coil-kt:coil-compose:2.4.0")

Dissimilation answered 30/5, 2023 at 21:47 Comment(1)
This answer should be accepted. I couldn't figure out the difference of 'coil' and 'coil-compose' until I saw your answer. TyTriste
L
0
implementation "io.coil-kt:coil-compose:1.4.0"
Leucopoiesis answered 22/7, 2023 at 8:7 Comment(1)
Answer needs supporting information Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Pyroconductivity

© 2022 - 2024 — McMap. All rights reserved.