Jonik Jonik - 11 days ago 5
Android Question

Notification icon missing with ProGuard enabled

After enabling ProGuard, our push notification icon (

res/drawable-*/ic_notifications.png
) has gone missing (only an empty circle, whose colour is
notificationAccentColor
, is shown).

The icon is only referred to from Urban Airship config file (airshipconfig.properties):

notificationIcon = ic_notifications
notificationAccentColor = #0000CC


I suspect ProGuard thinks the icon is unused, and removes it. Any way to tell ProGuard to keep it?

Answer

ProGuard does not remove resources. I suspect you use the shrinkResources feature of the Android gradle plugin? Take a look at the following page that describes how to keep certain resources from being shrunk: https://developer.android.com/studio/build/shrink-code.html (section Customize which resources to keep).

Comments