https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
p

Patrick Jackson

07/25/2019, 9:42 PM
Anyone have success with the kotlin xcode plugin? I install it and load the bundle, then xcode immediately closes. It does not seem to be loaded when I reopen. There is no syntax highlighting/ breakpoints.
k

kpgalligan

07/25/2019, 10:21 PM
Version? Mac and xcode
“then xcode immediately closes”, this may be the “Open Project” dialog under another window and/or on a different monitor
p

Patrick Jackson

07/25/2019, 10:32 PM
mac: 10.14.6 xcode: 10.3 checked for open windows and xcode was gone from the app switcher
k

kpgalligan

07/25/2019, 10:32 PM
Yeah, it doesn’t show up when it’s just that window, which is part of the confusion
Run it again and that window should pop right up. It’s possible it fully shuts down I guess, but it seems to come up really fast when running again (faster than usual)
Also, I assume you have the updates from yesterday. That added 10.3 support
p

Patrick Jackson

07/25/2019, 10:34 PM
get "konan_lldb.py found in ~/.lldbinit-Xcode" when running setup.sh again
goes straight to project dialog
k

kpgalligan

07/25/2019, 10:35 PM
That’s fine. It’s just saying it’s there
I mean, for “latest updates”, you cloned or pulled after 10.3 added
p

Patrick Jackson

07/25/2019, 10:36 PM
pulled latest master
about an hour ago
k

kpgalligan

07/25/2019, 10:36 PM
OK
Project open, and kotlin does not show up colored and you can’t apply breakpoints still?
p

Patrick Jackson

07/25/2019, 10:38 PM
yes, still nothing
FWIW, I've never had any luck with the VIM plugin either
k

kpgalligan

07/25/2019, 10:38 PM
Kotlin files show up as regular text?
p

Patrick Jackson

07/25/2019, 10:38 PM
yeas
k

kpgalligan

07/25/2019, 10:38 PM
Can you screenshot that?
p

Patrick Jackson

07/25/2019, 10:39 PM
actually, It is working now - I can jump to defs. that wasn't working before
nm, spoke too soon
k

kpgalligan

07/25/2019, 10:40 PM
You’re try to go from Swift (presumably) to Kotlin?
p

Patrick Jackson

07/25/2019, 10:40 PM
k

kpgalligan

07/25/2019, 10:41 PM
That’s styled. Not well styled, but you definitely have the plugin
Click the number 29. It should add a breakpoint there
?
p

Patrick Jackson

07/25/2019, 11:23 PM
Sorry, had to step out. Still no luck. That particular line isn't hit with current code. Will keep trying
k

kpgalligan

07/25/2019, 11:25 PM
“Still no luck” Can you set breakpoints, or you just haven’t run any code that would hit them?
p

Patrick Jackson

07/25/2019, 11:28 PM
set tens of break points and debugger does not stop. swift code is debugging
k

kpgalligan

07/25/2019, 11:29 PM
How are you adding kotlin files?
Xcode needs to point at the exact files you compiled. You cannot copy them to a different folder.
p

Patrick Jackson

07/25/2019, 11:30 PM
the kotlin xcode sync plugin
k

kpgalligan

07/25/2019, 11:30 PM
There is an issue I thought was related to catalina but perhaps not: https://github.com/touchlab/KotlinXcodeSync/issues/6
Xcode resolving different paths than what the kotlin compiler writes
You can try adding files through xcode directly rather than the sync gradle plugin
Can you find the path in xcode for the kotlin file?
Screenshot the top/right, if you can see it
Example from the bug. Crazy paths.
p

Patrick Jackson

07/25/2019, 11:53 PM
k

kpgalligan

07/26/2019, 12:06 AM
Paths don’t look wrong visually. The Kotlin compiler writes out paths for the debugger, and those need to match. If you compiled the kotlin code locally, and you’re using the debug framework (not release), then I don’t know what else. It’ll be very difficult to sort out, unless open source. I looked on github, and “open-library” does not appear to be.
The “plugin” essentially wires together some lldb things, but doesn’t really “do” a lot else. If the paths don’t match for some reason, the breakpoints won’t trigger. We’d need to write some kind of script to back into the compiled code and see what the paths are, but that’s nowhere near the current priority list, unless this gets more common (but this happened yesterday with Catalina, so perhaps it’ll be more common?)
p

Patrick Jackson

07/26/2019, 12:10 AM
how can debug/release framework be specified?
k

kpgalligan

07/26/2019, 12:11 AM
That’s kind of between you and xcode
Depends how you wired it up, depends on your settings, etc
p

Patrick Jackson

07/26/2019, 12:13 AM
looks like there I've used a "packForXcode" task and it gets it from the "XCODE_CONFIGURATION" property, and defaults to debug
I'll check that and make sure it is debug
k

kpgalligan

07/26/2019, 12:15 AM
I’d clone or create another smaller project and see if breakpoints work there. You could also try the droidcon project, although don’t run
pod install
. Sorting that out. If you hit breakpoints on other projects, it’s config. If not, something else is happening, although I can’t imagine what (other than the sync plugin messing up paths)
I’m making a very simple sample app, just to check the debugger. Will publish a bit later
(tonight, probably)
Well shit. I made a simple app to debug, and it didn’t work. Changed 1.3.41 to 1.3.40 and it works.
I’ve tried some at 1.3.41 and they worked, so I don’t thinks it’s quite as simple as that, but something is happening
p

Patrick Jackson

07/26/2019, 12:39 AM
what are steps to downgrade? can you just run setup.sh from old version?
k

kpgalligan

07/26/2019, 12:40 AM
No, I mean Kotlin 1.3.41 isn’t putting out the same debug info as 1.3.40, at least not by default
I changed nothing about the project or xcode
Other than the Kotlin version
p

Patrick Jackson

07/26/2019, 12:41 AM
wait, working for me now! I was getting the release framework apparently
and still on 1.3.41
k

kpgalligan

07/26/2019, 12:41 AM
Yeah, weird. Let me recompile with 1.3.41 again. If it starts working I’m closing the laptop
p

Patrick Jackson

07/26/2019, 12:42 AM
f yeah, this is a huge help. thanks for your help, and the plugin
k

kpgalligan

07/26/2019, 12:43 AM
Now 1.3.41 is working for me
Anyway, good luck. Work in that droidcon talk…
👍 1
*on
p

Patrick Jackson

07/29/2019, 6:05 PM
fyi, I'm still getting intermittent success with debugging kotlin in xcode. not sure why
k

kpgalligan

07/29/2019, 6:06 PM
Stopping at breakpoints, or advancing doesn’t line up as expected?
p

Patrick Jackson

07/29/2019, 6:12 PM
stopping at breakpoints works sometimes, other time it doesn't. Currently have no idea why. Maybe it is my setup, but just not consistent
k

kpgalligan

07/29/2019, 6:43 PM
I had the same issue when I first set up a test project last week. Wasn’t working, then it suddenly was. The “plugin” doesn’t do a whole lot, so this will probably a difficult one to sort out, but I have some ideas.
6 Views