Harsh Nandwani
Harsh Nandwani

Reputation: 1

Jetpack Compose App crashed when updated from previous version

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.

Upvotes: 0

Views: 917

Answers (1)

hi.cosmonaut
hi.cosmonaut

Reputation: 163

Check your file in drawable because 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 through Vector Asset tool

Attach you image/file under iconResId variable and I can tell you more

Upvotes: 0

Related Questions