java - Proguard warnings despite kept classes -
i'm using proguard shrink code. strategy enable , follow warnings keep complains about. if there outside libraries, try follow proguard instructions authors make available. many instructions include -dontwarn
flag. if disable -dontwarn
flag, warnings. if keeping classes via -keep
flag, why warnings still come up? example:
-keep class javax.** { *; } # butterknife -keep class butterknife.** { *; } -dontwarn butterknife.internal.** -keep class **$$viewbinder { *; } -keepclasseswithmembernames class * { @butterknife.* <fields>; } -keepclasseswithmembernames class * { @butterknife.* <methods>; } warning:butterknife.internal.butterknifeprocessor: can't find referenced class javax.annotation.processing.abstractprocessor warning:butterknife.internal.butterknifeprocessor: can't find referenced class javax.annotation.processing.processingenvironment warning:butterknife.internal.butterknifeprocessor: can't find referenced class javax.lang.model.element.typeelement warning:butterknife.internal.butterknifeprocessor: can't find referenced class javax.lang.model.element.element warning:butterknife.internal.butterknifeprocessor: can't find referenced class javax.annotation.processing.filer warning:butterknife.internal.butterknifeprocessor: can't find referenced class javax.tools.javafileobject ...
there many warnings in proguard meaning different things. particular one:
warning:a: can't find referenced class b
means while proguard processing class encountered reference class b. class b wasn't included source (-injars class_path
) or library (-libraryjars class_path
).
first note particular warning in case of standard android build chain adding -keep
rules not help. proguard transitively keeps referenced code.
this warning can happen several reasons. library x can contain code uses library y. , x uses y optionally - when y present on classpath, x doesn't enforce presence of y. way proguard unable find classes y. rid of warnings have either add y dependency or ignore relevant warnings.
in case of butterknife situation different. butterknife uses annotation processing. , contains both library , annotation processor in 1 dependency (latest version 7.0.1). class butterknife.internal.butterknifeprocessor
still present in compiled classes (even though it's work finished - used during java compilation). , proguard tries process it. proguard fails find missing classes because used during annotation processing , not present proguard processing. in case it's necessary ignore warnings.
Comments
Post a Comment