Hello ! I'm having an issue with IntelliJ 2021.3.1...
# compose-desktop
g
Hello ! I'm having an issue with IntelliJ 2021.3.1, when adding KMP 1.5.31 + Compose 1.0, dependencies are not properly indexed. Looks like simply removing the plugin fixes the indexing. I've tried re-installing, Repair IDE, rebuild, invalidate cache & restart, ... in vain so far. Any idea what could create this issue?
IntelliJ 2020.3.4, 2021.1.3, 2021.2.4, 2021.3.1 have the same issue.
d
Also you may try add to gradle.properties:
Copy code
kotlin.mpp.enableGranularSourceSetsMetadata=true
c
never heard of that property. im having the same issue.
d
In my case this property helps
Also I fix it with includeBuild projects, but it is no convinient way
c
just tried it. didn't work for me.
d
You may try to split project modules to different includeBuild's with: https://docs.gradle.org/current/userguide/composite_builds.html (but it's not convenient)
Also if you have android + jvm("desktop") targets - you may try to comment (disable) one of them
c
interesting. i will have to come back to this later, but i guess in the end. its still a bug in the IDE and likely not my configuration?
g
Thanks for the tips. I had granular sourcesets metadata already enabled (and try to disable it, no effect). I may have a dependency setup issue, if I've only a JVM target on a KMP project, does it matter if I use JVM or KMP dependency in commonMain? It looks like gradle was able to build in both cases, but IntelliJ maybe not. I also re-published the external library, now it looks like the IDE is going a bit better, as I can work with my dependencies properly, but then it's compose that is not recognize/indexed anymore. It's not red in IDE but I can't go in Compose code and I don't have autocomplete or any other IDE features 😞 I presume it's still a configuration issue that creates trouble with IntelliJ, but no idea what to search...
c
I'm not even sure it'd be a configuration issue. I have filed a few bugs related to this on the bug tracker and apparently my setup is fine. Its something in the IDE that is a problem.
🙏 1
a
I have had this issue before, and I recall it being a dependency resolution issue. Looks like you have a library that can't be used in a specific target. Likely to be an android library trying to be used in jvm desktop. Note that, it doesn't have to be just your direct dependencies, this issue can ripple from transitive dependencies as well
g
Thanks, it might be that. In my lib project, I generate jars with
jvm("android")
I was hoping the "android" part was just a name and no more impact on generated code, as I'm only using JVM code. Am I wrong? My (sample-)app project is a desktop app. It works fine, also I've used the same
jvm("android")
so that gradle can matches the name, without modifying the lib (as it's temporary, I don't want to export another target with the same content).