-
Notifications
You must be signed in to change notification settings - Fork 0
Eclipse Project Configuration
Once you have downloaded AndroidAnnotations, you may add it to your projects.
Warning: Make sure executing
java -versionin a prompt shows version 1.6.X.
Warning: Annotation processing is not well implemented on Eclipse 3.4.X. Please use at least Eclipse 3.5.
Note: If you use Maven in your Android projects, please follow the Maven + Eclipse instructions instead.
Please note that there are two important JARs in AndroidAnnotations:
-
androidannotations-X.X.X-api.jaris the API JAR, it must be in your build path and will be part of the final APK -
androidannotations-X.X.X.jaris the processor JAR, it's only needed at compile time, and must be in the compiler classpath.
Do the following to use AndroidAnnotations within the Eclipse IDE:
- Put
androidannotations-X.X.X-api.jarin thelibsfolder - Put
androidannotations-X.X.X.jarin another folder, for instanceext-libs.androidannotations-X.X.X.jarmust not go in thelibsfolder. - Right-click your project, choose "Properties"
- Go to
Java Compilerand make sure that "Compiler compliance level" is set to "1.6", otherwise the processor won't be activated - Go to
Java Compiler > Annotation Processingand choose "Enable annotation processing" - Go to
Java Compiler > Annotation Processing > Factory Pathand add the processor JAR :androidannotations-X.X.X.jar. - Confirm the workspace rebuild
- Go to
Java Build Path > Librariesand add the API JAR :androidannotations-X.X.X-api.jar, unless it's already in the build path (ADT 17 automatically adds JARs that are in the libs folder). - You can start using AndroidAnnotations and you should now see any annotation problems as regular error markers within the editor and in the Problem view.
-
If you get a
java.lang.IllegalArgumentException: already added: Lcom/googlecode/androidannotations/annotations/AfterInject;when compiling, please check that you did not put the processor jarandroidannotations-X.X.X.jarin thelibsfolder. -
If you get a
java.lang.NoClassDefFoundErrorat runtime, please verify inproject properties > Java Build Path > Order and Exportthatandroidannotations-xxx-api.jaris checked.
This documentation is highly inspired (not to say c&p) from the Hibernate Validation Annotation Processor Documentation. If you do not use Eclipse, you will find it quite helpful.
14/06/2012 The 2.6 release is out
- Get started!
- Cookbook, full of recipes
- List of all available annotations
- Release Notes
- Examples
- Read the FAQ
- Join the Mailing list
- Create an issue
- Tag on Stack Overflow