0

I have an Android library linked to a project and need to override some drawables defined in the former. Adding drawables with the same name to the project does not work, while other resource types like strings and layouts get overriden correctly.

Both drawables are vector drawables located in res/drawable folder but when I click "Go To -> Declaration or Usages" it shows the following list:

ic_drawable.xml (..myproject\app\src\main\res\drawable)
ic_drawable.xml (..user\.gradle\caches\transforms3\..\transformed\mylibrary\res\drawable-anydpi-v24)
+ a list of `ic_drawable.png` of different sizes

So it looks like gradle is transforming library verctor drawables into pngs of different resolutions and those are taking the priority over the project verctor drawable.

The same question was asked 10 years ago. Has any solution come since then?

yaugenka
  • 2,602
  • 2
  • 22
  • 41
  • Gradle wouldn't generate PNGs from vector graphics per default. That's the whole point of vector graphics, to keep the app size small by not needing separate images. Did you overwrite the drawable in all its variants? For example `anydpi-v24`. – Alexander Hoffmann May 05 '23 at 17:00
  • There is nothing else in the library or project but one vector drawble in the `drawable` folder. – yaugenka May 05 '23 at 17:19
  • Line 2 of your code snippet says something else. The drawable seems to be in the `anydpi-v24` folder – Alexander Hoffmann May 05 '23 at 21:59
  • That's is the point of it. There are no other drawable folders in the library except `drawable` one, but they do exist in the `.gradle\caches\transform` directory – yaugenka May 06 '23 at 12:50

0 Answers0