I am using the android:onClick
atribute in some of my .xml layout files for my android application, but ProGuard is removing these methods from my code when it runs because nothing in my code is ever calling them.
Rather then specifying each function individually, I would like to name them something like listener_functionName
, and use wildcards, like -keep listener_*
(I know this is incorrect, but hopefully it illustrates my goal).
If this is possible that would be great, but if not I still need to know how to specify these functions in the proguard.cfg file. Any help is appreciated.
According to proguard documentation:
Fields and methods may also be specified using regular expressions. Names can contain the following wildcards: ? matches any single character in a method name. * matches any part of a method name.
so, you will be find specifying
-keep class com.example.MyClass {
public void listener_*(android.view.View);
}
in your proguard flags.
You can do it once for all your classes in this way:
-keepclasseswithmembers class * {
void listener_*(...);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With