Questions tagged [annotation-processor]

An Annotation Processor is a compiler extension in the Java ecosystem. It uses a standardized API introduced by Java 6 and can be used with the compilers of OpenJDK, Eclipse, and Kotlin. Use this tag for questions related to the usage or implementation of annotation processors.

102 questions
63
votes
9 answers

Setting Explict Annotation Processor

I am attempting to add a maven repository to my Android Studio project. When I do a Gradle project sync everything is fine. However, whenever I try to build my apk, I get this error: Execution failed for task ':app:javaPreCompileDebug'. > Annotation…
wmrice
  • 631
  • 1
  • 5
  • 3
30
votes
1 answer

IntelliJ IDEA: Enable Annotation processors by default

How can I configure IntelliJ IDEA to have Annotation processors enabled by default? Currently, I have to enable it manually for every imported project.
Andrii Abramov
  • 10,019
  • 9
  • 74
  • 96
19
votes
6 answers

Error:Failed to resolve: annotationProcessor

This is the following error I am getting while adding a new gradle dependency to my android project. And this error is not project specific. I am getting the same error if I am adding the plugin in any other android project Error while adding any…
sagar suri
  • 4,351
  • 12
  • 59
  • 122
15
votes
1 answer

Dagger 2 with Android Studio 3.0 Preview (Canary 2) using annotationProcessor instead of android-apt

"A long time ago in a galaxy far, far away...." Ok, long story short - I decided to give Android Studio 3.0 Preview (Canary 2) a shot and I cannot make it work with Dagger 2 using annotationProcessor instead of android-apt. The error message I get…
14
votes
3 answers

Dagger can not find classes generated by other annotation processor

I have written a simple Annotation Processor (just for fun) that will generate some boilerplate code that I have been writing in my previous project. It actually generates a module like following by collecting annotations on Activity…
11
votes
3 answers

How to configure Java Annotation Processor(s) in Eclipse?

I have successfully run annotation processor for CLASS level retention annotations via command prompt compiling using Java 8. However, when I tried to configure the annotation processor in eclipse and tried to run it with "-proc:only" option, it…
Animesh
  • 189
  • 1
  • 3
  • 12
9
votes
1 answer

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

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…
Hector
  • 4,016
  • 21
  • 112
  • 211
9
votes
4 answers

Can't Debug an Annotation Processor when using kapt and gradle

I'm building an annotation processor, and I recently switched from using the default annotationProcessor type to kapt, using the kotlin-kapt plugin. I was debugging my processor by using the command ./gradlew --no-daemon -Dorg.gradle.debug=true…
9
votes
2 answers

How to process annotations with @Target(ElementType.TYPE_USE)?

I'm implementing an annotation processor to make sure that the elements marked with an annotation are instances of a class that implements a certain interface, or are uses of types that implement a certain interface: @Documented @Target(value = {…
9
votes
2 answers

annotationProcessor + androidTest + dagger2

For instrumented tests, I have a TestApplication that creates a TestComponent, but the file is not generated anymore (Error:/xxx/TestApplication.java:16: The import.xxx.DaggerTestApplicationComponent cannot be resolved). I'm not able to identify the…
8
votes
3 answers

Room annotation processor with Data binding

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…
8
votes
1 answer

Get package name and parametrized type from a field element - Annotation Processor

How can I get package name, generic type and Parametrized type from a type from a field element in Annotation processor? Say, if Element.asType returns java.util.List, I want to get Package name java.util Generic type List or raw type…
mallaudin
  • 4,744
  • 3
  • 36
  • 68
8
votes
1 answer

annotationprocessor and apt configure equivalent

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…
7
votes
2 answers

Is there a way to create custom annotations in Scala and write a custom annotation processor to verify the annotations?

I have been learning about annotations and what an annotation processor is. I was looking at Java examples and there seems to be a proper way to do it. However, in Scala, I do not get a proper website/documentation to create custom annotations and…
7
votes
1 answer

how can I use annotationProcessor in android.mk

I just want to use bufferknife and drag2 in my system app, I have built my app with the command mm. I have tried every possible method I could find, but failed! I've only found the below Android.mk by Googling: # Copyright (C) 2015 The Android Open…
feng
  • 71
  • 3
1
2 3 4 5 6 7