I'm having problems with @StringDef support annotations. They work great when the library in which they are located is part of the project (and not the .aar file), but when I compile the library as .arar files and try to use them in another project, annotations are not applied.
http://tools.android.com/tech-docs/support-annotations
The section "Using annotations in your own libraries" says
If you comment on your own libraries with these annotations and use Gradle to create the AAR artifact, during the build, the Android Gradle plugin will extract the annotation information and send it to your AAR file for use by your library clients. You can see the annotations.zip file inside the AAR where the information is written; it uses the IntelliJ external annotation XML format. This is necessary because .class files cannot contain enough annotation information to process the @IntDef information above; note that we need to write a link to a constant, not its value. The Android Gradle plugin will run the extraction annotation task as part of the if build (and only if) your project depends on the annotation support library. (Note that only source preservation annotations are placed in the .aar file; stored class-level values ββare stored in .jar classes.)
I opened the .aar file and inside it there is the annotations.zip file, and if I extract it, there is an XML file that has all the correct annotations.
I am using @Retention(RetentionPolicy.SOURCE) as it says what I need
The application I'm trying to use as .aar files has a dependency on the compile 'com.android.support:support-annotations:23.1.1 support library
What am I missing to make them work?
Edit: I double-checked that a project using them as .aar files also included an annotation handler.
source share