user1506104
user1506104

Reputation: 7106

Overriding an Android library project asset file

Based on the following links:

Best practice: Extending or overriding an Android library project class

https://developer.android.com/studio/write/add-resources.html#resource_merging

classes and resources in the Android library (AAR) are override-able. How about overriding an asset file? In my AAR file, I have an asset named first.xml. I want to create my own first.xml in my android project that overrides the file in my AAR. How do I do it?

Upvotes: 3

Views: 614

Answers (1)

user1506104
user1506104

Reputation: 7106

Here is the result of my test.

This is my assets/ inside the AAR:

-assets/
 -a.xml
 -b.xml

This is my assets/ inside my android project that depends on the AAR above:

-assets/
 -b.xml
 -c.xml

The resulting assets/ in my APK is below:

-assets/
 -a.xml (from AAR)
 -b.xml (from my project)
 -c.xml (from my project)

Upvotes: 3

Related Questions