Android & Proguard - how to obfuscate, but not optimise out any code?
I had similar problems a while back and solved it for me by brute force and luck. My proguard.cfg is similar but I have the lines:
-dontshrink
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
I can't remember from where I got the idea for these optimization options, but they seem to work for me.
There is always the catch all switch
-dontoptimize
(Specifies not to optimize the input class files. By default, optimization is enabled; all methods are optimized at a bytecode level.)
which might be more appropriate.
Finally I have methods which are only referenced in xml files (click handlers) which needed to be explicitly kept with
-keepclassmembers class * extends android.app.Activity {
public void myClickHandler(android.view.View );
}