Skip to content
Home » java.lang.IllegalStateException: function =

java.lang.IllegalStateException: function =

To solve java.lang.IllegalStateException: function = <anonymous> error follow below methods.

ERROR LOG

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

How to solve java.lang.IllegalStateException: function = <anonymous> ?

Simply follow all of the steps to resolve this problem.

  1. Open build.gradle file.
  2. Downgrade all implementations for compose to beta6
  3. Also compose navigation to 1.0.0-alpha08.

Alternative to Solve java.lang.IllegalStateException: function = <anonymous>

If I downgrade all compose implementations to beta6 and compose navigation to 1.0.0-alpha08, everything works fine. Alternatively, under composeOptions (in build.gradle, app Module), update kotlinCompilerExtensionVersion to 1.0.0-beta7 as follows:

android {
    ...
    composeOptions {
         val composeVersion by extra("1.0.0-beta07")
         kotlinCompilerExtensionVersion = composeVersion
    }
    ...
}

This sample is in build.gradle.kts

 Downgrading ConstraintLayout version from 1.0.0-alpha07 to 1.0.0-alpha06 solved the issue.

Hope the above solution works.

Also read :

The type already contains a definition Error
SyntaxError: invalid syntax to repo init in the AOSP code