Dagger 1 ProGuard rules

Dagger 1 - fast dependency injector for Android and Java.

ProGuard rules for Dagger 1

ProGuard removes in the optimization step unused classes, fields, and attributes and methods. After ProGuard shrinks your code, reading a code is difficult because the class names are obfuscated. Specify the following ProGuard rules in configuration file.

-keepattributes *Annotation*,EnclosingMethod
-keep @interface dagger.*,javax.inject.*
-keep @dagger.Module class *
-keepclassmembers class * {
    @javax.inject.* *;
    @dagger.* *;
    ();
}
-keepclasseswithmembernames class * {
  @javax.inject.* ;
}
-keep class javax.inject.** { *; }
-keep class **$$ModuleAdapter
-keep class **$$InjectAdapter
-keep class **$$StaticInjection

-keep class dagger.** { *; }
-keep class * extends dagger.** { *; }
-keep interface dagger.** {*;}
-dontwarn dagger.internal.codegen.**

For more information about Dagger 1 please see the website.

Related ProGuard rules

Static Gson ProGuard rules

Popular ProGuard rules