Debugging Gradle build scripts & Plugins [IntelliJ/Android Studio]
How to debug Gradle build scripts & Plugins using IntelliJ or Android Studio in 3 simple steps.
What do you can debug?
You can set breakpoints and debug:
- Standalone Gradle plugins
build.gradle.ktsfile on your project (only if you use
1. Configure IntelliJ / Android Studio
The first step is to create a new
Remote Configuration in
Android Studio on the project you want to debug.
Go to the configurations icon, and click on
Then click on the
+ symbol and pick
Finally, assign a name (for example
Gradle Remote Debug) and click on
2. Execute the task to debug
Now you can execute the task to debug. You need to add the following flags:
-Dorg.gradle.debug=true — no-daemon
./gradlew help -Dorg.gradle.debug=true --no-daemon
3. Attach the debugger
The previous task will wait until you attach the debugger. To do that, just pick the
Gradle Remote Debug configuration and then click the
Debug icon on the project to be debugged.
For more info, you can read the Gradle documentation.
If you enjoyed this article, you might get value out of these ones as well!
10 great ideas to improve your Gradle build times
Reduce your Gradle build times on android & non-android projects
Stop generating the BuildConfig on your Android modules
Why generating the BuildConfig class is a bad idea