I\'m struggling with the setup of Dagger (1.0.1), in a existing application. It was configured to use ProGuard but I disabled it for this test with -dontobfuscate
.<
Dagger doesn't require @Inject
to be on a class to be passed into graph.inject(myActivity)
because some activities may not have any injections to make. However, these seem like upstream dependencies, which means that they need to be provided to ComponentInfo
, and therefore need to be provisioned by Dagger. It cannot do this if it cannot create these classes, and it can't do so if these are not annotated, unless it provides them via a @Provides
method.
So, you either need to create an @Module
-annotated class which returns these types from @Provides
-annotated methods, or you need to add @Inject
to their constructor.
-keep class * extends dagger.internal.Binding
That said, in this case, are you using proguard in "release" mode? And not proguarding in debug mode? If so, I suspect Proguard to be stripping away annotations. You'll need to do some variant of:
-keep class javax.inject.** { *; }
... to ensure that Proguard doesn't remove the annotations.