Connecting the Debugger to the Android App Build Process
To do this, you only need to…
- In Android Studio, select the Edit Configurations item
- In it, add a new Remote configuration. No need to change the settings, just click OK:
- Start the build from the command line:
./gradlew --no-daemon -Dorg.gradle.debug=true -Dkotlin.daemon.jvm.options="-Xdebug,-Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y" assemble
- Immediately click on and don’t forget to set a breakpoint in the Gradle script.
This will also help debug a custom Annotation Processor.