An example of how to integrate AndroidAnnotations with Dagger. Experimental.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This project is an example to show how to integrate AndroidAnnotations with Dagger in an Android project.


  • AndroidAnnotations provides fast Android development and boilerplate reduction.

  • Dagger provides fast Dependency Injection on Android

  • AndroidAnnotations has supports for simple dependency injection, but not as broad as Dagger.

The aim was to see if there's interest in combining the two, if that's feasible, and how.

How to

  • Clone Dagger and run mvn install in the root repo folder
  • Then clone this project and open it in Eclipse
  • Copy/paste for the lazy guys:
git clone git://
cd dagger
mvn install
cd ..
git clone git://
  • This project is configured to work with Eclipse. I committed the Eclipse settings to help you with that. I have no idea whether it works with IDEA, Netbeans and friends. You'll need M2Eclipse and all the maven / android friendly plugins :) .

  • I coulnd't get it to build with Maven yet. Works within Eclipse. The current problem is that the @Module entryPoints parameter needs to point to the generated activity (which is the entry point). This works with Eclipse compilation, but fails with Maven. Investigation needed.

This project works as of {insert here last commit date on this project}. Since Dagger is still in 1.0-SNAPSHOT, this project may stop working at any time in the future. Including right now :) .


The integration of AA and Dagger would require a bit of work, but probably not that much. The main blocker for now is the tooling (Maven, Eclipse, …). We also need to see in which condition files generated by one annotation processor may be processed by another, etc.

Module generation

I couldn't get the com.squareup:dagger-androidmanifest-plugin maven plugin to work yet. So no automatic module generation for entry points, for now. Not sure how useful that is anyway.

Object Graph validation

The object graph validator seems to work fine within Maven, but didn't output any compile time error within Eclipse, although the FullGraphProcess actually runs. This needs investigation.


On my Galaxy Nexus, building the object graph takes between 10 to 20ms. Injecting the coffeeMaker takes 0ms. I guess we cannot draw any conclusion from that. See for yourself on a bigger project :) . Definitely worth comparing with RoboGuice.

Is that useful?

Read the source, Luke, and decide for yourself.