Looking for an example for Dagger assisted injection

So, some of the Dagger/Guice folks at Google created a thing called AutoFactory (http://github.com/google/auto) in a project that includes AutoFactory (code-generated assisted injection), AutoValue (code-generated custom value types) and AutoService (auto-generation of java services metadata files). AutoFactory pretty much operates like you would expect – it generates the factory you would otherwise have hand-rolled. It’s … Read more

Dagger 2 subcomponents vs component dependencies

Component dependencies – Use this when you want to keep two components independent. Subcomponents – Use this when you want to keep two components coupled. I will use the below example to explain Component dependencies and Subcomponents. Some points worth noticing about the example are: SomeClassA1 can be created without any dependency. ModuleA provides and … Read more

How to set up DAGGER dependency injection from scratch in Android project?

Guide for Dagger 2.x (Revised Edition 6): The steps are the following: 1.) add Dagger to your build.gradle files: top level build.gradle: . // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath ‘com.android.tools.build:gradle:2.2.0’ classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.8’ //added apt for source code generation … Read more