Eclipse ivy configuration - PerfectCarl/androidannotations GitHub Wiki

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.

Requirements

Add the following

Add ivy to your project

  1. Create the ivy manifest in the root of your project
<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="2.0"
    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" >

    <info
        module="your-module-name"
        organisation="your.organisation.namespace" >
    </info>

    <dependencies>
        <dependency
            name="androidannotations-api"
            conf="default->default"
            org="org.androidannotations"
            rev="X.X.X" />
    </dependencies>
</ivy-module>

Update the module name, the organisation and the androidannotations-api revision as necessary.

  1. Add the ivy dynamic library to your project. Go to the build path > libraries and click the add library button.

  2. Go through the wizard:
    Add library wizard

Leave the default values: Wizard step 2

  1. Resolve the dependencies. Right click on your project and go to Ivy > Resolve. Now ivy is retrieving the dependencies (and the source files if available): the androidannotations-api jar is available in the ivy classpath container.

Ivy classpath

  1. Export your Ivy classpath in your apk

Export your ivy classpath

Configure the AA annotation processor

  1. 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.
  2. Go to Java Compiler and make sure that Compiler compliance level is set to 1.6, otherwise the processor won't be activated
  3. Go to Java Compiler > Annotation Processing and choose Enable annotation processing
  4. Go to Java Compiler > Annotation Processing > Factory Path and add the processor JAR : androidannotations-X.X.X.jar.
  5. Confirm the workspace rebuild
  6. You can start using AndroidAnnotations

Troubleshooting

  • To check that AndroidAnnotations is activated, you should see AndroidAnnotations logs in the Eclipse Error Log (Window > Show View > Error Log) as soon as you save a file. If you do not see any log here, then it means AndroidAnnotations isn't activated yet.

  • If AndroidAnnotations isn't activated, this may be a Java version problem. You should check that eclipse.ini doesn't contain -Dosgi.requiredJavaVersion=1.5, and otherwise change it to -Dosgi.requiredJavaVersion=1.6.

  • When AndroidAnnotations is activated, You should now see any annotation problem as a regular error marker within the editor and in the Problem view.

  • Your project name should be identical to the name of the folder containing the project. When importing a project in Eclipse, the project name used is the name of the folder. Since the annotation jar is referenced by projectName/lib/androidannotations-X.X.X.jar, you may otherwise encounter errors when coworkers import your project.

⚠️ **GitHub.com Fallback** ⚠️