In my Android drawable folder I have certain images that are never directly referenced from the code so Proguard flags them as unused and they are not included in the release build.
To include said images I created a file keep.xml and added the following code:
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/*_thumb"
/>
When I now create a signed APK in Android Studio, everything works perfectly fine. In the Proguard-log (\build\outputs\mapping\release\resources.txt) file I can see the following lines and the images are now included in the build:
@drawable/image01_thumb : reachable=true @drawable/image02_thumb : reachable=true
Before adding the keep.xml the log would tell me that the images are not reachable, so the keep.xml does definitely work for the APK.
Here is the problem though: When I now create a signed App Bundle, then the Proguard log tells me that the images are again unreachable and so of course they are not included in the resulting App Bundle.
Question: Why does Proguard behave differently when I create an App Bundle and how can I fix this?
I know there are ways to indicate Proguard that certain resources are used from within the code, but in my case that is not a proper solution and I would like to solve this using the keep.xml