I've been building an Android app using Butterknife and recently upgraded to 7.0.1. I replaced all the @InjectView
and ButterKnife.inject
usage with the new @Bind
feature and have no problems with debug builds but the app crashes on startup for release builds.
If I switch 'minifyEnabled
' to false in my build.gradle then I can generate a working release build.
I'm using the proguard configuration thats documented on the Butterknife site but it doesn't appear to be working for me. I'm also using Dagger, Picasso and Flurry in my build.
My proguard-rules.pro contents:
# ButterKnife
-keep class butterknife.** { *; }
-dontwarn butterknife.internal.**
-keep class **$$ViewBinder { *; }
-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}
-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}
# Dagger
-keepclassmembers,allowobfuscation class * {
@javax.inject.* *;
@dagger.* *;
<init>();
}
-keep class javax.inject.** { *; }
-keep class **$$ModuleAdapter
-keep class **$$InjectAdapter
-keep class **$$StaticInjection
-keep class dagger.** { *; }
# Picaso
-dontwarn com.squareup.okhttp.**
# Flurry
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**