How to debug java source code when I implement a custom Detector for Lint?

后端 未结 1 1680
滥情空心
滥情空心 2021-02-01 21:55

I am a Android developer. I have already design my own lint rules by implementing new XXXDetector and XXXIssueRegistry, here is my source code snip:

My XXXIssueRegistry

相关标签:
1条回答
  • 2021-02-01 22:42

    To debug a custom lint check you need to run a Gradle lint task with -Dorg.gradle.debug=true parameter, for example:

    ./gradlew --no-daemon -Dorg.gradle.debug=true lintDebug

    The Gradle will stop execution until a debugger is attached.

    Attach a debugger to a local process:

    And select a corresponding Java process:

    After debugger has been attached, the Gradle will continue execution and you will able to debug your custom lint rule:

    0 讨论(0)
提交回复
热议问题