A couple months ago I played with adding the support annotations jar as a dependency to an annotation processor API similar to your 'api' module: https://gist.github.com/JakeWharton/e8a3685feb6a94b23393
I half-started expanding this into a Gradle plugin which included aar unpacking for provided deps and a provided android.jar for the actual processor module. Never got around to finishing it. On Mon Nov 17 2014 at 11:41:26 PM Kiran Rao <[email protected]> wrote: > @Xavier, here is a skeleton project I quickly put together. Do let me know > if you need more details: > > https://github.com/curioustechizen/studio-apt-android-dep-issue > > > On Tuesday, 18 November 2014 12:08:51 UTC+5:30, Xavier Ducrohet wrote: > >> Would you might making a very very simple project that shows the issue? >> That'll help me make sure we can make something that works. >> > On Sun, Nov 16, 2014 at 10:25 PM, Kiran Rao <[email protected]> wrote: >> > Bump! Any ideas on this? Or perhaps this is not the right forum for this >>> question? >>> >>> >>> On Thursday, 13 November 2014 18:37:03 UTC+5:30, Kiran Rao wrote: >>>> >>>> I am developing an annotation processor using Android Studio. My >>>> project has three modules: >>>> >>>> *anno-api*- This contains that API - i.e, just defines the annotations >>>> and some constants >>>> *anno-processor* - This has a compile dependency on anno-api and it >>>> contains the class extending AbstractProcessor >>>> *sample* - This demonstrates how to use the annotations. >>>> >>>> The setup is working just fine. Now, I want to do better validation in >>>> my Annotation Processor. For this, both anno-api and anno-processor need to >>>> have access to the Android API. >>>> For example, consider this annotation. It has a method of type Class >>>> but I want to restrict this to just sub-classes of Activity. >>>> >>>> @Retention(RetentionPolicy.SOURCE) >>>> @Target(ElementType.TYPE) >>>> public @interface AwesomeActivity { >>>> Class<? extends android.app.Activity> base(); >>>> } >>>> >>>> How do I go about doing this? *How do I tell anno-api and >>>> anno-processor to depend on Android classes?* >>>> >>>> Here are the things I tried: >>>> >>>> 1) I tried making both anno-api and anno-processor as Android Library >>>> projects. >>>> 2) I tried adding android.jar in the lib/ folder of the anno-api >>>> project and adding a dependency to the JAR file in build.gradle. >>>> >>>> In both cases the I end up with compile errors in my Annotation >>>> Processor. Basically it refuses to recognize the javax.annotation.* and >>>> other such classes. I suspect that at this point, only the classes present >>>> in android.jar are recognized. >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "adt-dev" group. >>> >> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected]. >>> >> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Xavier Ducrohet >> Android SDK Tech Lead >> Google Inc. >> http://developer.android.com | http://tools.android.com >> >> Please do not send me questions directly. Thanks! >> > -- > You received this message because you are subscribed to the Google Groups > "adt-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
