Integrating AndroidAnnotation with Intellij IDEA 12
Asked Answered
K

3

16

I can't configure my IDE (Intellij IDEA 12) to work with AndroidAnnotations (http://androidannotations.org/) previous configurations screenshots differ from the new ide that jetbrains just released. Can somebody give me a step by step configurations.

Kinetics answered 12/12, 2012 at 4:4 Comment(0)
U
17

I've gotten it working, with some minor issues (which might just be related to my setup, your milage may vary)

Ok, so :

  1. Get the androidannotation-(vernum).jar and the api jar
  2. Save your androidannotation-(vernum).jar inside your project somewhere but not in your libs folder. (I saved it in a separate "aa" folder)
  3. Save the api jar in your "libs" folder
  4. Go to the Intellij Settings/preferences screen. Under Compiler > Annotation Processors are the settings you want. Adjust profiles so the annotations processing can be run on the right modules.
  5. You then enable annotation processing and set the processor path to the location of androidannotation-(vernum).jar
  6. you store generated sources relative to your module content root
  7. Now here's where problems for me started. Intellij gave me first errors of not finding the AndroidManifest file, and it gave duplicate class errors. To solve issue 1 I added the processor option androidManifestFile and set the absolute path of the xml file. The second issue was solved by outputting the generated sources to the gen folder. (this folder is also used by Android compiling for generating R.class and such)
  8. Afterwards, build your entire project. Normally gen should be set up as a source folder in your module already.

If you got some other issues, let me know, I've been fiddling with it for the past few days. My current only "bug" is that whenever I modify sources that use AndroidAnnotations, I have to rebuild my entire project, instead of just my main module. It seems that Intellij 12 does not reprocess the annotations on module building.

Uncritical answered 12/12, 2012 at 9:10 Comment(4)
ashokgelal.com/2012/12/… As an exta bonus, this guy wrote a blogpost about Intellij 12 and AndroidAnnotations.Uncritical
What I overlooked at first: You need to set the Store generated sources relative to-Setting to: Module content root. Otherwise IntelliJ won't be able to recognize the output Folder as sources.Passed
not working anymore with intellij 12.1 : fixed dont use gen as output folder, used aa-gen and worked fineDoubleripper
I added Spring Android to my project (IntelliJC 13 + MVN) and Android Annotation Processing stopped working. Followed step 7 and it fixed my errors. Thanks!Neuropathy
C
0

One issue that kept me busy quite some time was that somehow IntelliJ got its config files messed up. I had to delete the whole annotationProcessing block from the .idea/compiler.xml file. After that, everything was fine.

Circassian answered 2/11, 2013 at 13:59 Comment(0)
M
0

For current version of Intellij IDEA I found a post describing pretty details how to configure AA within Intellij IDEA

http://hintdesk.com/android-introduction-to-androidannotations-maven-in-intellij-idea/

Moderator answered 4/5, 2014 at 15:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.