Just tested to create a sample default app from AS...
# compose
t
Just tested to create a sample default app from AS to see the defaults and I see that
Copy code
vectorDrawables { useSupportLibrary = true }
is set. Is this necessary? Since compose does not use the appcompat layout inflater I would have supposed this have no effect.
n
Correct compose does not read this value
👍 1
c
That flag doesn't affect Compose or views. It tells AGP to not render vector drawables as bitmaps to support older platforms (API < 24 iirc). You should still set that flag if you're using vector drawables, as it means that you'll only be bundling the XML versions in your app.
t
@cb are you sure? IIRC The bitmap stuff is for < API 21. Then AppCompat have something for API 21 - 23 to workaround OS bugs don't remember if it's that flag or something else (like AppCompatResources) hence the question about Compose having those workarounds for 21-23 or appcompat is needed with that flag too.
c
Yes. There are a number of features which were added to VectorDrawable after API 21 (not only bug fixes), which AGP renders to bitmaps on older platforms. Composes supports all of the features 'natively', but you still need to tell AGP to turn off the rasterization.
The flag also tells AAPT2 to not move VD XML files which use attributes which don't exist on earlier API levels.
TL;DR: you should set the flag if you're using vector drawables, in either views or Compose 😀
t
Hum so there can still be xml to png done by AGP when API 21+ ? I need to triple check that. Is there a way to debug / log those ? Anyway thanks for the details will try to remember to use that flag.
c
Easiest way to debug is to use APK Analyzer on the built APK, then look at the resources folders.
👍 1