Reputation: 3730
I'm trying to make a project using jetPack Compose , i have all necessary dependencies for it to work but when i run my app , it throws an error that i couldn't find a solution for
java.lang.AssertionError: CALL 'public final fun <get-currentComposer> (): androidx.compose.runtime.Composer<*> declared in androidx.compose.runtime.ComposerKt' type=androidx.compose.runtime.Composer<*> origin=FOR_LOOP_ITERATOR
def jetpackDef = "1.0.0-alpha09"
// Jetpack compose navigation
implementation "androidx.navigation:navigation-compose:1.0.0-alpha04"
implementation "androidx.compose.ui:ui:$jetpackDef"
// Tooling support (Previews, etc.)
implementation "androidx.compose.ui:ui-tooling:$jetpackDef"
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation "androidx.compose.foundation:foundation:$jetpackDef"
// Material Design
implementation "androidx.compose.material:material:$jetpackDef"
// Material design icons
implementation "androidx.compose.material:material-icons-core:$jetpackDef"
implementation "androidx.compose.material:material-icons-extended:$jetpackDef"
// Integration with observables
implementation "androidx.compose.runtime:runtime-livedata:$jetpackDef"
implementation "androidx.compose.runtime:runtime-rxjava2:$jetpackDef"
implementation "androidx.compose.runtime:runtime:$jetpackDef"
buildFeatures {
// Enables Jetpack Compose for this module
compose true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
useIR = true
}
Any Help would be appreciated guys , thank you .
Upvotes: 4
Views: 1200
Reputation: 2107
For me JuliusScrip's answer didn't completely solve it: if you use ext.kotlin_version
in your build.gradle(:project)
file, you'll need to update that too:
buildscript {
ext.kotlin_version = "1.4.21"
...
}
For anyone needing more details, this video is completely about this error: https://www.youtube.com/watch?v=itvv6m4haGY&feature=emb_logo
Upvotes: 0
Reputation: 3850
I got it working by settings the composeOptions, I got this error when I had kotlinCompilerExtensionVersion = "1.0.0-alpha08", whilst rest of the libraries where alpha09.
composeOptions {
kotlinCompilerVersion = "1.4.21"
kotlinCompilerExtensionVersion = "1.0.0-alpha09"
}
Upvotes: 13
Reputation: 13926
There seems to be an issue with compose version alpha09
, downgrade to alpha08
and it should work.
Source: https://issuetracker.google.com/issues/176046527
Upvotes: 0