annotation-processor

How do you specify buildConfigField in Gradle Java-library Project build script

你离开我真会死。 提交于 2020-01-13 09:45:46
问题 Within my Android projects I can specify Gradle constants as follows: buildConfigField 'Boolean', 'analyticsEnabled', 'false' and access them in my Android application like this:- public boolean isAnalyticsEnabled() { return BuildConfig.analyticsEnabled; } How can I get the same functionality within a Java library Gradle build script? To be more precise, I am developing a custom annotation processor as a pure Java project (library) that my Android application is dependant on. I would like to

error: package generated.schema does not exist

喜夏-厌秋 提交于 2019-12-24 19:18:14
问题 In my Android Application I have an annotation processor which generates files using JavaPoet and places them under the package generated.schema. The files are generating correctly. Whenever I use the generated file like so GeneratedFile.someGeneratedMethod(); I get the following error: error: package generated.schema does not exist. But if I include the fully qualified class name instead of importing like so generated.schema.GeneratedFile.someGeneratedMethod(); the code compiles and runs

Nested Target in MapStruct (Using Lombok) not working fluently

て烟熏妆下的殇ゞ 提交于 2019-12-24 19:16:19
问题 I am trying to use Mapstruct to do some nested mapping and with Lombok. As according to their latest specification mapstruct 1.2 works out of the box with Lombok. Here is my code: Source Classes @Builder @Getter @Setter public class PojoA { private String stringA; private int integer; private PojoB pojoB; } @Builder @Getter @Setter public class PojoB { private long aLong; private String string; private PojoC pojoC; } @Builder @Getter @Setter public class PojoC { private int value; } Target

Kotlin-Kapt Annotation Processor not working with maven

江枫思渺然 提交于 2019-12-24 07:46:44
问题 I want to generate jpa querydsl files from kotlin entity classes. There is a very good examples online of how to generate the dsl files using gradle https://github.com/JetBrains/kotlin-examples/blob/master/gradle/kotlin-querydsl/build.gradle. However I have tried to implement this in maven and have had no luck. My current pom is below. Does anybody know what the issue might be? Thanks in advance. <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM

Room annotation processor with Data binding

女生的网名这么多〃 提交于 2019-12-18 11:35:03
问题 I have used Data binding in my existing code and now I am migrating to Room for persistence. I have followed the steps mentioned in Florina's Blog for room My Code builds fine without java code error or BR related error when I remove room dependency annotationProcessor 'android.arch.persistence.room:compiler:1.0.0' and its runs too, but gives Runtime exception saying database_Impl does not exists. As it couldn't generate that's file. But after I put Annotation processor back, it give me Error

How do I share dependencies that use annotationProcessor between Android modules?

霸气de小男生 提交于 2019-12-10 17:33:51
问题 I have an Android application module (A) and an Android library module (B). Both (A) and (B) contain these same dependencies: dependencies { implementation 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' } However in my project the module (A) is depending on module (B) so I did search on the stack overflow about how could I implement Don't Repeat Yourself design pattern so that I will include those dependencies only in the module (B) and I

How to read a Class[] values from a nested annotation in an annotation processor

爱⌒轻易说出口 提交于 2019-12-10 17:29:13
问题 I am trying to generate some code using Java annotation processing tools, I have nested annotations where the parent annotation value is an array of the child annotation, and the child annotation value is an array of classes. Annotations: public @interface ParentAnnotation { ChildAnnotation[] value(); } public @interface ChildAnnotation { Class<?>[] value(); } Usage: @ParentAnnotation( { @ChildAnnotation({Foo.class, Bar.class}), @ChildAnnotation({Goo.class, Doo.class}) }) public class Sample{

Can't import AAR library with @IntDef annotations

混江龙づ霸主 提交于 2019-12-10 16:24:01
问题 I have the following code in my library: @Documented @IntDef({OpacityAnimationType.NONE, OpacityAnimationType.BLINKING, OpacityAnimationType.SHINY, OpacityAnimationType.AURA, }) public @interface OpacityAnimationType { int NONE = 0; int BLINKING = 1; int SHINY = 2; int AURA = 3; } In gradle for library I have android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { minSdkVersion 16 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support

Android Studio 2.3 update : Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior

廉价感情. 提交于 2019-12-07 00:50:00
问题 So, I have read all the questions I could find on this site regarding this issue. I have also had a chat in comments with one of the developer with similar issue, who was able to solve it. I dont have apt or annotationProcessor written any where in my gradle scripts. I dont have the word android-apt written anywhere in my code. I even went ahead and checked out all the libraries. That were included in my project. This is a really big problem and needs to be solved. I am attaching the modified

annotationprocessor and apt configure equivalent

与世无争的帅哥 提交于 2019-12-05 23:15:54
问题 I'm using AndroidAnnotaion , but due to Android Studio 2.3 and Gradle 2.3.0, they said android-apt was obsoleted. And annotationProcessor is a new one. so, I want to know how can I configure annotationProcessor like I do with apt before. If I misunderstand something, please help. So, before... apply plugin: 'android-apt' dependencies { def AAVersion = '4.2.0' apt "org.androidannotations:androidannotations:$AAVersion" compile "org.androidannotations:androidannotations-api:$AAVersion" } apt {