2014-03-06 49 views

回答

31

即使你没有张贴一个实际的问题,我假设你想要的警告产生了APK期间面对这个错误。

添加以下行到您的ProGuard配置:

-dontwarn butterknife.internal.** 
-keep class **$$ViewInjector { *; } 
-keepnames class * { @butterknife.InjectView *;} 

source

+0

这个解决方案给做作品谢谢! – mithil1501

+2

如果我们保持butterknife类,为什么我们需要-dontwarn线?为什么警告仍然出现? – Vas

+0

请注意,“-keepnames class *”将意味着您的类名不会被混淆。 – aaronmarino

5

如果有人确实面临使用ProGuard和Butterknife问题,请使用以下的http://jakewharton.github.io/butterknife/index.html#proguard

-keep class butterknife.** { *; } 
-dontwarn butterknife.internal.** 
-keep class **$$ViewBinder { *; } 

-keepclasseswithmembernames class * { 
    @butterknife.* <fields>; 
} 

-keepclasseswithmembernames class * { 
    @butterknife.* <methods>; 
} 
+1

这些来自ButterKnife网站的说明很有用,谢谢。现在可以通过改造等方式面对其余的错误:P – voghDev

+0

将这些添加到您的proguard-project.txt文件中#不要警告 –

+2

链接(http://jakewharton.github.io/butterknife/index.html#似乎是坏的,主页(http://jakewharton.github.io/butterknife/)似乎没有提到Proguard;这些规则仍然是必要的吗? –