A third party Gradle plugin can be difficult to debug. In my case, I couldn't figure out why an input in my build.gradle file wasn't causing the plugin to add a desired task to a build. It's also not straightforward to inspect the source code of a plugin that arrives prebuilt. Fortunately if the plugin is open source, you can breakpoint in the source.
This thread forms the basis of these steps:
- clone the source code for the plugin, and checkout the commit or version tag reflecting the version of the plugin you want to debug
- open the repo in IntelliJ IDEA / Android Studio and allow gradle to sync
- create a run configuration, selecting
Attach to Remote JVM
- make your breakpoints in the source code
- in the project with the gradle build you want to debug, run
./gradlew --no-daemon -Dorg.gradle.debug=true app:uploadBugsnagReleaseSourceMaps
, gradle will wait for a debugger to attach - back in the source code repo for the plugin, hit
Debug