Hey everyone So in my KMP project, lately I've bee...
# multiplatform
s
Hey everyone So in my KMP project, lately I've been getting this error quite frequently while adding dependencies
Caused by: java.lang.IllegalStateException: Projects must be configuring
But I've observed that this error only arises for two modules (i.e.
Desktop
and
Web
) and these are 2 of the 3 platforms I had introduced manually to the project (the 3rd being Ktor Server module (i.e. JVM)). Now it feels like I might've missed something while setting up these 2 platforms. So I wanted to ask if you all have been facing the same, and if so, then how did you resolve it? I have been trying out some random things like using older versions of these dependencies, invalidating cache, and so on but it's like a hit-and-miss experiment for me. If you have a look at the image attached, you'll be able to see that there are some hacks going on in the form of empty gradle tasks like
wrapper
,
prepareKotlinIdeaImport
and
prepareKotlinBuildScriptModel
because if I don't do so, then gradle complains about these tasks not being available and I wasn't sure how to fix it.
Note: These empty gradle tasks are only present in the :desktop (JVM) module and no other modules.
So any ideas, please?
a
do you have Gradle Configuration Cache enabled? What version of Kotlin are you using? https://youtrack.jetbrains.com/issue/KT-52647
s
@Adam S I'm not sure how to check if I have
Gradle Configuration Cache enabled
, could you please tell me how I can check that? And I'm on Kotlin 1.7.21 btw.
a
You should see a message in the build logs, something like
Copy code
Calculating task graph as no configuration cache is available for tasks…
Configuration Cache is disabled by default because it’s incubating, so if you (or someone else who works on the project) haven’t enabled it, then it shouldn’t be a problem https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:usage:enable
Kotlin 1.7.21 should be okay. • What version of Gradle are you using? • Are you using
allprojects {}
or
subprojects {}
anywhere in the build config? • does this problem only happen in IntelliJ, or also when you run tasks from the command line? • does this command work?
Copy code
./gradle clean assemble --no-build-cache --no-configuration-cache --rerun-tasks