This is probably an edge case but maybe there's so...
# multiplatform
t
This is probably an edge case but maybe there's something easy to fix this. I'm using a KMP library as a composite build inside a pure Android application. Android Studio (Flamingo) is having issues resolving dependencies between modules inside that library. Everything works at compile time and opening the library in AS directly works correctly too. I have no idea where to start looking at since there's no errors at compile time and it's IDE issue only.
t
t
Thanks, I'm too used to only look on Google tracker and not JB.
a
I would recommend to use Electric Eel. Google has this tradition of delivering new AS with new issues.
v
I face this issue in: • Electric Eel • Dolphin • IntelliJ versions until 2022.2 Maybe Flamingo or 2022.3 EAP improved uppon this, but I doubt it. The problem already existed to some degree before Hierarchical Project Strucutres (Kotlin
1.6.21
), where the IDE failed to autocomplete types and suggest auto-import when using library types from the Android project. But it got worse after that. The elephant in the room is that the Kotlin Plugin for the IDE (be it IntelliJ or Android Studio) doesn't officially support Multiplatform projects + Composite builds, see this issue. As you can see in the comments, @mbonnin did come up with a work-around there to solve it, although I'm not sure he had the same exact issue with composite builds (IDE not resolving symbols between modules of the included build). I tried my luck with it and couldn't make it work with all the IDEs I mentioned before. The project I'm working on has a different structure so maybe I missed something when trying to apply the same idea and ended up leaving it to the side. We ended up staying in
1.6.10
because we're really close to releasing to prod, and we want stable grounds and as-fast-as-possible development until then. Considering that the IDE can resolve all symbols from the library when making changes to the Android project. And that the IDE can resolve all library symbols from other modules when opening the IDE in the library directly. Our team agreed that after we release we're bumping Kotlin, updating libraries and start: • Opening the IDE on the Android project if you want to make changes there • Opening the IDE directly in the KMP library if you want to change the library Personally I already do this most of the time anyway. But for some that got used to just opening the Android project and managing everything in there, this can be a bit annoying to get used to.
m
Amen to what @Vitor Hugo Schwaab said. We manage to make it work with workarounds that are far from ideal because every IDEA sync makes the full build out of date :-( I really hope this can be addressed soon 🤞
c
This issue is also about the same, and at least it seems like JetBrains identified the root cause, but it isn’t clear if it is being worked on or not: https://youtrack.jetbrains.com/issue/KTIJ-15775/MPP-IDE-Lots-of-red-code-unresolved-references-with-HMPP-and-composite-build