断点调试gradle插件

Windows系统下使用以下命令:

1
2
3
4
SET GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"

// 一直等待,直到attach到调试进程
gradlew :app:taskName -Dorg.gradle.debug=true --no-daemon

在Android Studio或Intellij Idea的”Run/Debug Configurations”中添加Remote,host设置为”localhost”,端口号设置为”5005”,然后attach到调试进程上即可。