Reputation: 53
I just tried to load an image from my resources with val context = ambient(ContextAmbient)
but when I try to run the project I get an error during the generation of the code.
java.lang.IllegalStateException: Backend Internal error: Exception during code generation
@Composable
fun MovieImage(image: Int) {
val context = ambient(ContextAmbient)
Container(modifier = Modifier.None, width = 24.dp, height = 24.dp) {
DrawImage(image = imageFromResource( context.resources, image))
}
}
Upvotes: 5
Views: 2517
Reputation: 4067
I ran in to the same problem when upgrading from 0.1.0-dev03
to 0.1.0-dev05
.
It was solved by adding composeOptions{ kotlinCompilerExtensionVersion "0.1.0-dev05" }
to my build.gradle
like this:
android {
// ... other gradle properties
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion "0.1.0-dev05"
}
}
Upvotes: 4