Add dagger support
alexandru-calinoiu opened this issue · comments
Hi,
Any luck with http://square.github.io/dagger/ ?
Here is what I use for dagger 1.2.1. Reportedly Dagger 2.0 (yet to be released) does not need any rules at all:
-keepclassmembers,allowobfuscation class * {
@javax.inject.* *;
@dagger.* *;
<init>();
}
-keep class javax.inject.** { *; }
-keep class **$$ModuleAdapter
-keep class **$$InjectAdapter
-keep class **$$StaticInjection
-keep class dagger.** { *; }
-dontwarn dagger.internal.codegen.*
@dalewking thanks, do you want to add that as a pull request? If not, I can take care of it, but I always like having more contributors.
Wait for now, as this is still not working completely yet
To the best of my knowledge there is no concrete solution due to how Dagger builds the graph/configuration. One has to provide explicit -keepnames
entries for anything any module @Provides
.
This worked for me
-keep class dagger.** { *; }
-keepclassmembers,allowobfuscation class * {
@javax.inject.* *;
@dagger.* *;
<init>();
}
-keep class **$$ModuleAdapter
-keep class **$$InjectAdapter
-keep class **$$StaticInjection
-keep class javax.inject.** { *; }
-dontwarn dagger.internal.codegen.**
-dontwarn dagger.producers.internal.**
-dontwarn dagger.shaded.auto.common.**
I added a Dagger config from another PR. See https://github.com/krschultz/android-proguard-snippets/blob/master/libraries/proguard-square-dagger.pro. If that doesn't work we can revise it, but it was fairly close to what @ivazhnov suggested so worth a shot.