Problems with proguard and the android compatibility package

I’ve been playing with Fragments lately and so I’m using the android support package so I can get Fragments in pre 3.0 version of Android.
However when I build the app proguard complains about being unable to find some classes referenced by the compatibility package.
Here are some of the warnings proguard throws:
[proguard] Warning: android.support.v4.widget.EdgeEffectCompatIcs: can't find referenced class android.widget.EdgeEffect
[proguard] Warning: android.support.v4.widget.EdgeEffectCompatIcs: can't find referenced class android.widget.EdgeEffect
[proguard] Warning: android.support.v4.view.MenuCompatHoneycomb: can't find referenced method 'void setShowAsAction(int)' in class android.view.MenuItem
[proguard] Warning: android.support.v4.view.ViewGroupCompatIcs: can't find referenced method 'boolean onRequestSendAccessibilityEvent (android.view.View,android.view.accessibility.AccessibilityEvent)' in class android.view.ViewGroup
[proguard] Warning: android.support.v4.view.accessibility.AccessibilityManagerCompatIcs$1: can't find referenced class android.view.accessibility.AccessibilityManager$AccessibilityStateChangeListener
[proguard] Note: the configuration refers to the unknown class 'android.widget.EdgeEffect'
[proguard] Note: the configuration refers to the unknown class 'android.view.accessibility.AccessibilityRecord'

That looks to me like the support package is trying to use some Honeycomb only classes.
After some research I found that the easiest way to get rid of those warnings is to have proguard not warn about the missing classes.
To do that, I added this line to my proguard.cfg file:

-dontwarn android.support.v4.**

If you can narrow it down to only a certain package you can ignore just that more specific package, but I would’ve had to make 3 new rules for proguard in my case.

Another way to fix those warnings is to change the API version you’re targeting (if you have that possibility).
API version 11 is Honeycomb so that should have all the missing classes.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">