Excellence kawej
07/03/2025, 11:56 AM/Users/ctrltech/StudioProjects/Tmaterials/shared/src/commonMain/kotlin/com/geekpastor/shared/ui/components/singleComponents/AppBar.kt:67:35 Unresolved reference 'painterResource'.
As you can see, it's happening in commonMain module, and I've tried to find a multiplatform library for resources, but it seems to not be stable each time I have tried to install it, it causes other issues. Doo you have ay other solutions that you could suggest me???Pavlos
07/03/2025, 12:25 PMpainterResource
with no issues at all at commonMain
, this is my import:
import org.jetbrains.compose.resources.painterResource
Excellence kawej
07/03/2025, 12:56 PMPavlos
07/03/2025, 1:06 PMcompose-multiplatform = "1.8.2"
composeMultiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" }
Excellence kawej
07/03/2025, 1:33 PMExcellence kawej
07/03/2025, 1:53 PMPavlos
07/03/2025, 2:16 PMAdrien de Sentenac
07/03/2025, 3:43 PMExcellence kawej
07/04/2025, 1:36 PMPavlos
07/04/2025, 1:44 PMExcellence kawej
07/04/2025, 1:49 PMExcellence kawej
07/04/2025, 1:49 PMExcellence kawej
07/04/2025, 1:50 PMExcellence kawej
07/07/2025, 9:18 AMImage(
modifier = Modifier
.fillMaxWidth(0.4f)
.fillMaxHeight(),
painter = painterResource(id = Res.drawable.ic_launcher_foreground),
contentDescription = "Logo de l'application",
contentScale = ContentScale.Crop
)
Unresolved reference 'Res'.Adrien de Sentenac
07/10/2025, 2:42 AMcompose.resources {
publicResClass = true
packageOfResClass = "your.package.name.resources"
generateResClass = always
}
Then you should be able to import it with:
import your.package.name.resources.Res
See https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-multiplatform-resources-usage.html#customizing-accessor-class-generation for details.
Also, you're using the wrong painterResource
, you should import the one from compose multiplatform:
import org.jetbrains.compose.resources.painterResource
which takes a resource
as parameter, not an id
.