Skip to content

CustomizeAnnotationProcessing

Damien edited this page Dec 24, 2013 · 4 revisions

You have the possibility to customize annotation processing to fit your needs if you have some special use cases. To do so, you can declare options in your configuration (see below to see how to configure them according to your environment).

Available options

Trace

Type: boolean

trace is used to enable or disable @Trace annotation processing. This annotation is used to trace the execution of a method by writing log entries.

androidManifestFile

Type: string, path

By default, AndroidAnnotations try to find the AndroidManifest.xml file by looking recursively in parent folders. In case you have a specific project structure, you can specify the path to AndroidManifest.xml file by using androidManifestFile option.

resourcePackageName

Type: string

By default, AndroidAnnotations try to find the R class by extracting application package from AndroidManifest.xml file. But in some cases you may want to specify a custom package to look for the R class. This is why we added resourcePackageName option.

logFile

Type: string, path

Since 3.0, AndroidAnnotations uses a custom logger to write logs in a file during code generation. It'll help everyone to debug and fix configuration in case of issues.

By default, the framework will write logs in {outputFolder}/androidannotations.log file. And to resolve {outputFolder}, we're looking for one of the following folders in this order :

  • target
  • build
  • bin
  • root project folder

If the output folder can't be resolve you can specify an output file by using logFile option. Note that you can also use {outputFolder} placeholder in this value if you just want to change the filename.

logLevel

Type: string, enum(trace, debug, info, warn, error)

The default log level is set to DEBUG. In case of issues, it could be useful to change it to TRACE with logLevel option.

logAppenderConsole

Type: boolean

By default, AA uses two appenders : FileAppender and MessagerAppender. The former will write in the log file and the latter will show log messages in IDE messages. But, there is also a ConsoleAppender which could be activated by setting true to logAppenderConsole option.

How to use options

TODO : explain for Eclipse, IntelliJ, maven and gradle

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Clone this wiki locally