So I updated IntelliJ IDEA and now I have lost com...
# kotlin-native
r
So I updated IntelliJ IDEA and now I have lost completion and everything about my cinterops in IDEA. Anyone knows how to reliably get them back? I tried resetting everything and rebuilding a few times
b
This happens often to us... usually just clear cache and restart in intellij, and then run the assemble gradle task
☝️ 1
b
It sometimes helps clearing gradle cache and build outputs too.
r
Yeah that’s what I keep doing… Still nothing
Nah this really doesn’t work anymore. I think something changed, maybe in a recent Kotlin version or in IDEA, and maybe I cleared a cache or something that can no longer be built with the current version. I see some new Gradle task like commonizer and runCommonizer and I don’t really know what they are
s
Open for jumping into Google meet with me to figure out what is happening?
K 1
r
Would be nice, but it’s not possible 😅 Currently trying to subclass an ObjC thing from a lib without the IDE then move on. I don’t need much so I’ll do it that way. I don’t use many ObjC libs anyway, as it has been a pain from day one
🆗 1
s
Feel free to reach out to me for support 😉 Or suggestions, or when just wanting to share pain points.
👍 1
r
I do use a Kotlin lib which relies on an ObjC lib via cinterop, and I can see this cinterop, it’s only the cinterop that I am doing in this project which are missing. Weird.
I use a Kotlin lib which wraps the bugsnag-cocoa ObjC lib with cinterop
s
Hey! Unfortunately, I won’t be able to give chat support here 🙄 You can ping me if you would be up for jumping into a call or when creating a ticket. One issue that I am fixing right now, that might affect you is that cinterops are not imported into the IDE when there is an intermedate source set that only supports a single native target: https://youtrack.jetbrains.com/issue/KT-47523
r
Well this project’s build file was made at the end of 2019 so unless the changes adding intermediate sourceSets and commonizer have side effects it doesn’t apply here I think
s
I mean, I could find out what the issue is by either looking at a reproducer, or just looking at your project 👀
m
Whenever cleaning and invalidating cache didn't help, it usually meant that something was wrong with my project config. You can try to move a few commits back to see if it works and maybe do git bisect then. Once it also said something in the build logs, some warning, I think
b
Whats the cause of this though? it would be nice if it didn't happen at all
m
Kmm being in its infancy, I would assume ;) honestly, I wonder too, it happens quite often and for a few things it's always red for me, e.g. kotlinx.serialization plugin for ktor is never recognised by AS in my projects for some reason.
@Sebastian Sellmair [JB] since the ktor/serialisation is always red for me, I could probably show you that when you're available
s
9:20 AM CEST? 👍
m
Sure :)
s
I will send a link ☺️ blob smile happy
👍 1
Ready when you are 👍 To join the video meeting, click this link: https://meet.google.com/hjo-iqng-iad Otherwise, to join by phone, dial +49 40 8081617067 and enter this PIN: 458 726 814# To view more phone numbers, click this link: https://tel.meet/hjo-iqng-iad?hs=5
r
I think that one of the issues that makes this hard is that when you enter a state where it can no longer work, either by configuration change or in my case versions update (I didn’t change anything else in my config), IntelliJ still has a cache from when it worked, so when you finally clear this cache for whatever reason and it cannot build it again, it’s hard to find when it stopped working. In my case I managed to do what I wanted to do without the IDE (maybe took 10x more time, but worked) and I basically use ObjC libs in less than 30 lines of code total in this 28k lines project, so I’m gonna work on features instead until it becomes a real blocker
s
I can only repeat myself here: Feel free to reach out to me here, once you need support! Only precondition from my side: • Create a YouTrack ticket (best case with reproducer) • Or (and this is preferred by me): Just jump into a call with me on Google Meet virtual meeting
r
See I didn’t change anything and continued working on my project after that. And right now it just started working again. So I was correct saying I have no configuration problem, the IDE is just funky with some cache somewhere I don’t know exists and don’t clean.
So I found a way and the start of an explanation on why my dependencies aren’t resolved. I usually build and run my app on a device, because my Mac is kinda slow so running a simulator makes everything a little bit slower in general. Now sometimes the USB connection to the device is unstable due to Apple sucking in general I guess, and there are periods where I do use a simulator for some time instead of a device because that day Apple’s gods decided it should not work. So I just discovered that one Build & Run to simulator in XCode, followed by a Gradle refresh in IntelliJ once it’s running, resolves my dependencies correctly. I guess whatever is built when your target is arm64 cannot be found by IntelliJ but the x86 stuff is. Anyway I’ll just run on simulator once before working with ObjC libs from now on and it’ll be ok. Maybe this can help others
(And yes, one Build & Run to device in XCode, followed by a Gradle refresh in IntelliJ, and everything’s red again)