Automatic drawable xml-to-png conversion at build time not compatible with overriding Android library drawable resource from Android application

683 views
Skip to first unread message

Enrico Tibaldi

unread,
Mar 21, 2017, 10:19:27 AM3/21/17
to adt-dev
I've recently faced this issue. Anyone else?

--

Using:

Gradle version 3.3
com.android.tools.build:gradle:2.3.0
buildToolsVersion "25.0.2"
compileSdkVersion 25
minSdkVersion 19
targetSdkVersion 25

appcompat:
'com.android.support:appcompat-v7:25.3.0'

How to reproduce:

- Create new Android application project "app"

- Create new Android library module ("mylibrary") and set it as a dependency to application

- In library module create new drawable .xml vector asset (from Asset Studio) inside the /mylibrary/src/res/drawable/ folder and save it as "my_icon.xml"

- Create activity "MainActivityLibrary" in library module with image view that loads the icon android:src="@drawable/my_icon"

- In application module create new drawable .xml vector asset (from Asset Studio) with a DIFFERENT icon and save it inside the /app/src/res/drawable/ folder as "my_icon.xml" (with the same name as the library icon, so that it should get overridden)

- Make application MainActivity extend MainActivityLibrary and remove setContentView(...) from MainActivity

- start the app

RESULT: The app displays the library icon
EXPECTED: The app displays the application icon

NOTES: If the icons are defined instead separately in drawable-xxhdpi-v4/ and drawable-v21/ respectively as "my_icon.png" and "my_icon.xml" both in the library and the application, the resources are overridden correctly. 



Reply all
Reply to author
Forward
0 new messages