Hi Everyone. Several people have run into an issue...
# touchlab-tools
b
Hi Everyone. Several people have run into an issue in Android Studio with KMP projects when using the TouchLab Xcode Kotlin plugin. The issue is defined here: https://youtrack.jetbrains.com/issue/KMT-1299/After-upgrading-to-Narwhal-Project-JDK-is-not-defined A few details: When you have an "integrated" project, and you use the Xcode Kotlin plugin to debug kotlin code in Xcode, you will run into this issue when you open the project in Android Studio Narwhal (and have the Kotlin Multiplatform Plugin enabled in Android Studio). As stated in the linked issue, when you add a reference to the Kotlin source files in your Xcode project (so that you can set breakpoints and debug), it causes some kind of issue, and back over in Android Studio everything goes haywire. If you remove the references to the Kotlin source files from the Xcode project, the project immediately starts working again in Android Studio. Anyway, I don't know/think this is an issue with the Touchlab Xcode plugin (it seems to be an issue with the IntelliJ KMP Plugin for Android Studio). But I wanted to post it here in case anyone else runs into it. h/t to @Brandon Smith for figuring out the issue!
k
I left a comment. Effectively, we use the standard way of registering file types in Xcode, and adding references as expected in Xcode. There's really no other option, as Xcode is basically not extensible in any meaningful way. The Xcode plugin does two basic things: register
*.kt
files as source code files, and provide a source coloring definition for Kotlin files. The complex thing it does is all in lldb, and should be unrelated. My guess is whatever changed in the KMP plugin now imports all source files from Xcode. They'll need to filter Kotlin files. I'm guessing it's something related to the same files being referenced in both places. I doubt there's much we can do from our end. The way Kotlin files are registered as source files, and how they're added, hasn't fundamentally changed since we first published the plugin in 2019. But, I haven't actually run it. I'm guessing. However, the way we're doing that is rather basic, and hasn't really changed, so I can't imagine what else would be happening.
b
Thanks @kpgalligan. Seems pretty clearly to be an "issue" with the KMP plugin in Android Studio. I mainly wanted to post here in case someone else runs into this issue and comes here looking for solutions. Hopefully the JetBrains team can get a fix sorted out in relatively sort order.
k
I'm glad you posted it. I had no idea there were issues. Again, I would assume the cause is relatively obvious once they dig into it. The KMP plugin parses the Xcode project to find files, and if Xcode has Kotlin files in there, it's probably trying to include those. But, they conflict with the files already in the KMP project, so odds are it's something related to that.