Add ability to turn off generating PNG from SVG

721 views
Skip to first unread message

Rustam G

unread,
Nov 3, 2015, 1:08:30 PM11/3/15
to adt-dev
Hi,

I'm using an amazing library which lets me to use AnimatedVectorDrawables on Pre-Lollipop devices as well as VectorDrawables. Now I am able to transform my vector drawables when I use com.android.tools.build:gradle:1.3.1. Generating PNGs from my VectorDrawables breaks that ability on com.android.tools.build:gradle:1.4.0-beta1 and higher. 

It would be great if I could set a flag that tells build tools not to generate PNGs. It would be even more useful If I could specify for which vector-drawables I need PNGs to be generated. Probably it is better to have a tool inside the IDE to generate PNGs not during build time but when I Import a Vector Asset.


Thanks,
Rustam

Xavier Ducrohet

unread,
Nov 3, 2015, 1:10:53 PM11/3/15
to adt...@googlegroups.com
Controlling which vector drawable need png is done with the folder name. drawable-v22 skips compatibility mode and doesn't trigger them.

If you're doing pre-processing, I would suggest putting the files somewhere else than the normal res folders, and make a gradle task that generates the resources as you need and register that task as one that generate resources.

--
You received this message because you are subscribed to the Google Groups "adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adt-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

Rustam G

unread,
Nov 5, 2015, 3:46:02 AM11/5/15
to adt-dev
If I put my drawables to drawable-v22 folder I get ResourceNotFoundException on pre-API v22 devices. I don't need the feature of rasterization vector drawables because I have the library which makes them work just fine on API 14+ without any efforts from my side. 

Trying to avoid the generation of PNGs by making changes to the source code seems like hacky workaround.

The idea to generate PNGs from VectorDrawable is good but I need to have an opportunity to transform one VectorDrawable to another. That is what AnimatedVectorDrawable designed for. 

I would like to use DataBindings as it seems to be a nice tool but I can't update to tools version higher than 1.3.1 because of PNGs generation.

Thank you.

Michal Bendowski

unread,
Nov 12, 2015, 6:01:28 AM11/12/15
to adt-dev
In 1.5.0 final, if you set "defaultConfig.generatedDensities = []", the whole feature should be disabled.

MIchal

Rustam G

unread,
Nov 12, 2015, 6:05:02 AM11/12/15
to adt...@googlegroups.com

Thanks.

What for is this setting supposed to be?

You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/Snv3dW2dEM4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adt-dev+u...@googlegroups.com.

Michal Bendowski

unread,
Nov 13, 2015, 5:52:40 AM11/13/15
to adt...@googlegroups.com
It controls which densities are used for generating PNGs from vector XMLs, so if you set defaultConfig.generatedDensities = ["xhdpi", "xxhdpi"] you will only get two PNGs per XML.

See the DSL reference.

Michal
Reply all
Reply to author
Forward
0 new messages