Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.IllegalStateException: function = <anonymous>, count = 4, index = 4

I am getting this error when I build the project

java.lang.IllegalStateException: function = <anonymous>, count = 4, index = 4
at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.wrapFunctionExpression(ComposerLambdaMemoization.kt:697)
at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitComposableFunctionExpression(ComposerLambdaMemoization.kt:544)
at androidx.compose.compiler.plugins.kotlin.lower.ComposerLambdaMemoization.visitFunctionExpression(ComposerLambdaMemoization.kt:608)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionExpression(IrElementTransformerVoid.kt:235)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunctionExpression(IrElementTransformerVoid.kt:24)
at org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl.accept(IrFunctionExpressionImpl.kt:23)
at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:33)
at org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression.transformChildren(IrFunctionAccessExpression.kt:48)

Here are my dependencies

implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.compose.ui:ui:1.0.0-beta06"
implementation "androidx.compose.material:material:1.0.0-beta06"
implementation "androidx.compose.ui:ui-tooling:1.0.0-beta06"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.0-alpha08'
implementation "androidx.navigation:navigation-compose:2.4.0-alpha01"
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.0-beta06"

Jetpack compose used to work fine for me on Artic Fox Canary but when I build my project on Artic Fox Beta 1, I get this error.

like image 512
Adi Avatar asked May 20 '21 09:05

Adi


1 Answers

Update all compose libraries to beta07:

implementation "androidx.compose.ui:ui:1.0.0-beta07"
implementation "androidx.compose.material:material:1.0.0-beta07"
implementation "androidx.compose.ui:ui-tooling:1.0.0-beta07"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.0-beta07"

implementation "androidx.navigation:navigation-compose:2.4.0-alpha01"

It would be better to use something like:

ext {
    compose_version = '1.0.0-beta07'
}

and then:

implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
//...
like image 173
Gabriele Mariotti Avatar answered Oct 12 '22 23:10

Gabriele Mariotti