How to make vector application vector override library vector?

I have a library project and an application project. Among other things, the libary project contains some png and some vector drawings. Now I can easily overwrite the png extracted in the application project by giving it the same name and it will display correctly. However, this does not work with vector drawings: the application always shows vector drawings defined in the library, both on Android 4 and 5. The application will never display drawings of vector application projects.

Google claims that application resources always take precedence over library resources :

Since the tools combine the resources of the library module with the resources of the dependent module of the application, this resource identifier can be defined in both modules. In this case, the tools select the resource from the application or library with the highest priority and discard another resource. Keep in mind that shared resource identifiers are likely to be defined in more than one project and combined with the priority of the resource from the application or library with the highest priority.

But, as I said, in the case of vector drawings, for some reason, it's the other way around. Any idea what I can do to make sure that vector drawings are redefined in the same way as regular drawings and other resources?

UPDATE : Solved in the v23.2 support library ! Now do nothing :)

+4
2

"" , , , PNG:

build/intermediates/res/merged/debug , build/intermediates/res/merged/<flavor>/debug. PNG , :

drawable-ldpi-v4
drawable-mdpi-v4
drawable-hdpi-v4
drawable-xhdpi-v4
drawable-xxhdpi-v4
drawable-xxxhdpi-v4

, , , . , VCS, PNG. Unversioned Files.

, drawable-anydpi-v21, 7 - : (

: v23.2! , , - . , : srcCompat android: src .

+3

, VectorDrawable PNG VectorDrawable drawable-anydpi-v21.

VectorDrawable drawable-anydpi-v21 , . , ( ).


: PNG . , .

+6

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


All Articles