In my Android app I ofter don\'t create a View\'s on-click handler in code, but rely on the ability to specify it in the XML layout file, like this:
-keepclasseswithmembers class * {
public void onSearchClicked(android.view.View );
}
but double check it from proguard doc : http://proguard.sourceforge.net/index.html#/manual/refcard.html
This seems to be the best answer, as it is 100% robust to naming of such methods:
# This will avoid all the onClick listeners referenced from XML Layouts from being removed
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
Hope it helps.
I use:
-keepclassmembers class * extends android.app.Activity {
public void on*Click(android.view.View);
}
and then I name all onClick methods like: onCancelBtnClick(), onBackgroundClick(), etc.