Git Product home page Git Product logo

androidannotations-dagger-example's Introduction

Introduction

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

Purpose

  • 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://github.com/square/dagger.git
cd dagger
mvn install
cd ..
git clone git://github.com/androidannotations-dagger-example.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 :) .

Conclusion

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.

Perfs

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.

androidannotations-dagger-example's People

Contributors

pyricau avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.