Android Studio 3.0 vector drawables and LINT tools: ignore = "VectorPath"

After upgrading to 3.0, Android Studio started complaining about long paths in vector drawings.

The warning reads:

A very long vector path (7958 characters), which is bad for performance. Given the decrease in accuracy, the removal of small parts or rasterization vector. less ... (⌘F1) Using long vector paths is bad for performance. There are several ways to make pathData shorter: * Use less accuracy * Delete some small details * Use Android Studio vector conversion tool * Rasterize the image (convert to PNG)

The documentation https://developer.android.com/guide/topics/graphics/vector-drawable-resources.html shows us how to use vector drawings in our applications, and recommends it for png, etc.

I use the Android Studio Vector Conversion Tool and this great service for converting SVG to vector drawings: http://inloop.imtqy.com/svg2android/

Are there other services that do more to reduce the complexity of vector transfer? Where can I find recommendations on how β€œadvanced” my vector drawings can be?

+5
source share
2 answers

An additional step that you can add before using svg2android , which runs it through svgo

An example of the pipeline used (note that instead of a web tool I use svg2vectordrawable )

 ~$ svgo image.svg --config=config -o image.svg.optimized ~$ s2v "image.svg.optimized image.xml 

My config file looks like (you can play with it according to your needs):

 "plugins": [ { "convertPathData": { "leadingZero": false, "floatPrecision": 2 } } ] 
+4
source

Try optimizing the vector using avdo ! This should help reduce the complexity of your paths.

+2
source

Source: https://habr.com/ru/post/1273138/


All Articles