My app crashes when updated from previous version with Exception:
java.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
It runs fine when new version is fresh installed. The problem only occurs when it is updated from older version. It crashes on my second activity where I show image from drawables folder, the launcher activity works just fine.
This is how I show drawable image:
Image( painter = painterResource(id = myDataClass.iconResId), contentDescription = "" )
myDataClass is a data object, upon every app start I initialize iconResId propery with xml drawable resource id (since it can change on every app launch).
I have done upgrading properly: versionCode of new apk is greater than old apk versionName is also different string.
Might be worth noting, There are couple of extra drawables added in new version but none of old ones removed.
Tried debugging and checking if resource id is properly initialized in iconResId propery. It is being initialized properly.
Check your file in
drawablebecause if it is regular image with xml tags such as<shape/>,<layer-list/>etc - then you can't use it in Jetpack Compose. You should use .png/.jpg/.webp and other supported extensions or svg image imported throughVector AssettoolAttach you image/file under
iconResIdvariable and I can tell you more