Question

Does anyone know how to enable annotation processing in Eclipse in an Android Project? I did the following:

  1. Created a Java Project with the Processor and the META-INF > services file with the class name of the Processor that i want to use;
  2. Exported the Processor project to a .jar file;
  3. Imported the Processor jar file to a folder (not /libs) and configured the project properties to enable annotation processing (Properties > Java Compiler > Annotation Processing).

If I remove the jar file from the folder, Eclipse reports an error in the project because the annotation processor was not found. But if the processor is in place and the Eclipse is configured, the processing does not occur.

If I use the same processor in a standard Java Project it works just fine.
Can someone help me? Thanks

Était-ce utile?

La solution

Found the problem:

The Project Properties must have the compiler compliance level set to no less than 1.6, or else the processor won't be executed...

Autres conseils

i am using ADT23 with Eclipse Luna. Go to your project properties and select Java Compiler and select you Compiler Compliance Level to 1.6. Then your Annotation Processing option will be enable. Create a folder compile-libs in your project, where your lib folder and paste jar file androidannotations-3.0.1.jar this location compile-libs\androidannotations-3.0.1.jar .

Add androidannotations-api-3.0.1.jar in your project libs\androidannotations-api-3.0.1.jar .

Finally, you must add both file path in your Factory Path. e.g {Your Project}/compile-libs/androidannotations-3.0.1.jar and {Your Project}/libs/androidannotations-api-3.0.1.jar

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top