dagger android支持proguard规则

时间:2017-08-27 18:48:37

标签: android proguard dagger-2 android-proguard dagger

我正在使用带有 Proguard Dagger2 android-support 库但由于此错误我无法编译我的项目:

Warning:dagger.android.AndroidInjector: can't find referenced class com.google.errorprone.annotations.DoNotMock
Warning:dagger.android.AndroidInjector$Builder: can't find referenced class com.google.errorprone.annotations.DoNotMock
Warning:dagger.android.AndroidInjector$Factory: can't find referenced class com.google.errorprone.annotations.DoNotMock
Warning:dagger.android.DaggerApplication: can't find referenced class com.google.errorprone.annotations.ForOverride
Warning:dagger.android.DispatchingAndroidInjector: can't find referenced class com.google.errorprone.annotations.CanIgnoreReturnValue
Warning:there were 5 unresolved references to classes or interfaces.

我正在使用的Dagger版本是2.11

问题是我应该为Dagger2 android支持库使用Proguard规则吗?

1 个答案:

答案 0 :(得分:42)

应该是:

-keep class com.google.errorprone.annotations.** { *; }

更新:单靠以下规则就足够了,无需添加以前的规则。

-dontwarn com.google.errorprone.annotations.**