- Add two modules one for api and other for processor(Ensure its a java library) - There are conflicts in javax pacakges between android jar and jdk javax packages.
- include apt plugin
apply plugin: 'com.neenbedankt.android-apt'
buildscript {
repositories{
mavenCentral()
}
dependencies{
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
- Use apt in dependencies
apt 'for.remote.projects:1.0.0'
apt project(':forLocalProjects')
- Create meta inf
inside src/main
create resources directory
inside resources * create META-INF directory
inside META-INF * create services
inside services * create javax.annotation.processing.Processor
Give processor full class path in it
com.example.com.MyProcessor
To debug
./gradlew --no-daemon -Dorg.gradle.debug=true :app:clean :app:compileDebugJavaWithJavac
Add a remote run config and run after the above command