
组件化系列博客 :
在 注解处理器 的 process 方法中加上断点 ,

选择 " 菜单栏 / Run / Edit Configurations… " 选项 ,

在弹出的 " Run/Debug Configurations " 对话框中 , 点击左侧的 " + " 按钮 , 在弹出菜单中选择 " Remote " ,

创建好后 , 将 " Command line arguments for remote JVM " 对话框中的内容复制下来 ,
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
到 Gradle 面板中 , 找到 " app / Tasks / other / compileDebugJavaWithJavac " 选项 ,

右键点击 " compileDebugJavaWithJavac " 选项 , 选择 " Create ‘Component.appcompileDebugJavaWithJavac’ " 选项

输入以下内容 , 该内容是从 " Run/Debug Configurations " 对话框中复制出来了 , 将 suspend=x 改成了 suspend=y ;
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
点击 " OK " 按钮完成创建 , 然后在可运行任务中变显示该任务 , 点击瓢虫图标 , 即可调试 , 并进入到 注解处理器断点中 ;

断点在 注解处理器 的 process 方法中阻塞住 , 之后可以按照断点处理的方式 , 调试后续 注解处理器 中的代码 ;

博客源码 :