How to debug the apt AbstractProcessor code generation?

1.1k views Asked by At

I'm trying to use apt and generate some code, so I've got a not working sample from here imported it to Android Studio, made it work and placed it here in case anyone else would want a working sample of APT on Android with Android Studio.

So Once I've got the project running and working I'm going to temper with it and stress its capabilities, and I would like to be able to debug my code and not only observe helplessly at the output.

So, how can I debug the code of the AbstractProcessor of APT, using Android Studio or Plain IntelliJ?

1

There are 1 answers

0
TacB0sS On

Success... SO the solution is a combination of these two posts one and two...

So basically you add a Remote debug configuration (be sure the port is set to the same as the following lines), and add the following line to your gradle.properties file:

org.gradle.parallel=true
org.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

DONE! now you can debug your AnnotationProcessor!