Overriding an Android library project asset file

半世苍凉 提交于 2020-06-17 15:45:07

问题


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?


回答1:


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)


来源:https://stackoverflow.com/questions/62115925/overriding-an-android-library-project-asset-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!