Hello everyone. So, I was having an issue with dep...
# multiplatform
r
Hello everyone. So, I was having an issue with dependency resolution not working. Which is related to this: https://youtrack.jetbrains.com/issue/KTIJ-22111 The current solution was staying on Bumblebee or Intellij IDEA 2021.3 with AGP 7.04. This has worked perfectly for quite a while but now even Intellij IDEA 2021.3.1 and AS Bumblebee do not work. I'm using Windows 11. I have 2 Multiplatform projects and no dependencies in commonMain or androidMain are being resolved with Intellij IDEA 2021.3.1 (only those is jvmMain and jsMain work). In Bumblebee they all get resolved but break when you build and run the project (they start working again after you manually resync gradle). In Intellij IDEA 2022.2 EAP7, AS Chipmunk and Dolphin (which are know to have this issue), import for things originating from commonMain do not work inside commonMain or androidMain for all imported multiplatform libs (either from another module within the project or downloaded) Now, the issue from Intellij IDEA 2022.2, AS Chipmunk and Dolphin are known and fixes are underway. What I was wondering is why did it also break (in a different way) for Intellij 2021.3.1 and Bumblebee which were working perfectly fine with the old AGP versions. After looking
idea.log
this section seems to repeat itself for both Intellij IDEA 2021.3.1 and AS Bumblebee which shows some errors when syncing: https://pastebin.com/Q8qYJpgc. Is this related to the issue or is there something wrong with my config. One of those projects can be found here: https://github.com/Thinkrchive/Thinkrchive-Multiplatform. The branch
working-kotlin-js-support
is the one I'm currently working on and the one with all the issues. The 2nd project (larger one) is not open source unfortunately but has a very similar project structure and gradle configuration, but they both exhibit the same issues.
Update: So, I disabled gradle configuration cache and that seems to have fixed red lines for unresolved dependencies inside all main sources sets (still unresolved for test). But auto imports for anything that has
expect
in
commonMain
(even within the same module) do not work. Tested on the following IDEs: AS Bumblebee, Chipmunk, Dolphin, Intellij 2021.3.1 & 2022.2 EAP7. Auto imports for commonMain
expect
declarations only works in Intellij 2021.3.1 and Bumblebee (which is expected as per issue 22111)
e
I think I have the same issue, but I'm not sure how to proceed to fix this. Has this been fixed in some IDEA / AS version? Or is this fixed in some KMM version? Manually typing and using imports from the common module works and the Android unit tests run fine, but all the code referencing common things is red in the IDE.
r
I disabled Gradle configuration cache and it worked. See the comment above yours
e
OK thanks. Here (https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:usage:enable) I read that it's disabled by default. And that there are multiple ways to enable/disable it. Which did you use? I added
Copy code
org.gradle.unsafe.configuration-cache=false
To my gradle.properties, but it didn't solve the problem.
Ah, wait, I read now that they're still unresolved in tests
So that was to be expected 🤦‍♂️
In other words: there is no workaround/fix for this at this time?
Also, I guess my problem's different or that the solution doesn't do anything, because I tried enabling the configuration cache and that fails the build (that otherwise passed).
r
They said it was supposed to be fixed in Intellij 2022.2 Beta 2 (which just released yesterday) and Android Studio has fixed some of the issues in Electric Eel. I haven't tried to open the project after updating Intellij today, you could try with that though some of your plugins will probably be incompatible
@Erik You could try enabling the lines I've commented out at the bottom of [this file](https://github.com/Thinkrchive/Thinkrchive-Multiplatform/blob/working-kotlin-js-support/gradle.properties), one by one. These fixed my issues before but kinda break everything in commonMain sometimes when you build the project. You could try them and see if they work you.
e
Thanks. I didn't manage to fix it, but it'll eventually be fixed in AS/IJ. I won't try to an experimental IDE version for this project, so I'll have to write tests without code completion. I can always temporarily copy the code under test to the test file, write the code with completion, and then remove the copy from the test code. It's not that big of a project
Do you know how long the lifecycle of AS/IJ versions is and how fast the alpha/beta/stable releases receive updates like these? This seems like something that might be patched, and it might not require a major/minor IDE release.