Hello! Are there any tutorial on how can I debug k...
# kontributors
i
Hello! Are there any tutorial on how can I debug kotlin compiler? I have an android project and kotlin compiler crashes for some reason. I'd like to run a debugger and find outh what causes it to crash.
For anyone who in the future will need to debug the kotlin compiler, here's an easy way: 1) Download kotlin repo 2) Open it with IDEA 3) add this option into gradle.properties of target project:
Copy code
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5007 -Dkotlin.compiler.execution.strategy=in-process
4) Attach to remote debugger in IDEA 5) ??? 6) Profit!
👍 1
Starting from kotlin 1.6.20 it’s better to use gradle property or
KotlinCompile
task. https://kotlinlang.org/docs/whatsnew1620.html#properties-for-defining-kotlin-compiler-execution-strategy For instance, you can use
kotlin.compiler.execution.strategy=in-process
property in your
gradle.properties
file