IntelliJIDEA - shiraji/androidannotations GitHub Wiki

Notes

Setting up the project

Please note that there are two important JARs in AndroidAnnotations:

  • androidannotations-X.X.X-api.jar is the API JAR, it must be in your build path and will be part of the final APK
  • androidannotations-X.X.X.jar is the processor JAR, it is only needed at compile time, and must be in the compiler classpath.

Adding the jars to the projects

  • Put androidannotations-X.X.X-api.jar in the libs folder
  • Put androidannotations-X.X.X.jar in a different folder, such as compile-libs. androidannotations-X.X.X.jar must not go in the libs folder.

Importing the project into IntelliJ

  • Go to File -> Open...
  • In the dialog window, select your project folder and click OK
  • If the Framework detected popup shows up, click on the Configure link on it, then select the desired Android SDK and click OK
  • Open File -> Project structure -> Modules -> Dependencies and add the dependencies from the libs folder
    • Click on the green + button
    • Select JARs or directories...
    • Select the libs folder -> OK
    • Toggle the first checkmark so the jar is exported
  • Open File -> Settings -> Build, Execution, Deployment -> Compiler -> Annotation processing and add the AndroidAnnotations processor
    • Select your project in the left pane
    • Toggle Enable annotation processing
    • Select Processor path
    • Click ... right to Processor path and browse androidannotations-X.X.X.jar from the compile-libs folder
    • Switch the Store generated sources relative to to Module content root
    • Close the window by clicking OK
  • Make the project, this will also launch annotation processing
  • Open File -> Project structure -> Modules -> Sources, then right click the generated folder and select Source

Next step