By default all Kotlin tasks run in Kotlin Compile Daemon, which is a separate process.
This argument:
-Dkotlin.daemon.jvm.options="-Xdebug,-Xrunjdwp:transport=dt_socket\,address=5005\,server=y\,suspend=n"
tells Kotlin to start a daemon process, which will listen on 5005 port for a debugger.
org.gradle.debug=true
tells Gradle to start a process, which will listen on 5005 port for a debugger.
Two processes cannot listen on the same port, so you should specify a different port for Kotlin daemon.
Alternatively you can simply omit -Dorg.gradle.debug=true
, since KAPT runs APs in Kotlin daemon.
If you’re using Kotlin 1.3.20, you can also add kapt.use.worker.api=true
to Gradle properties, and debug Gradle process instead. Note that only with 1.3.20 kapt.use.worker.api
runs KAPT in-process (before this option used Gradle Worker Processes by default).