Sunday, March 6, 2011

Proguard - keeping onclick methods from layout xml

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names.

When running Proguard on your jar-file it is important to configure it to keep click listeners that you use from your layout xml.
# keep methods accessed from xml/android:onClick
-keepclassmembers class *{
public void *(android.view.View);
More on Proguard.
More on click listeners from layout xml.


  1. clever - thanks a bunch!

  2. This comment has been removed by a blog administrator.