Here's a small Gradle plugin that helps out if you have a project that includes an annotation processor. There are two use cases for this plugin:

1. You have a processor that has a compiler part and an api part, you don't want to get the compiler in your app. For this purpose the plugin sets up an apt configuration.
2. Your annotation processor produces source which you want to reference in Android Studio. By default these kinds of projects build fine in Android Studio, but the generated source isn't on any source path in Android Studio so you might get errors there. The plugin will add the generated source to a source set so that AS will recognize it. This is also true for the first case btw; if the processor generates source, it will be added to the source set for the current flavor.

This is all based of a script that I've been using but it got a bit cumbersome to check out the script for each project and I thought providing it as a plugin might be useful for others as well.

One thing that is still missing is the option for passing in arguments to the annotation processors, when I have the need for it I'll add it, but pull requests are welcome.

It's live on Maven Central so easy to add to your build if you need it.
More info and source is here:

Shared publiclyView activity