android - 覆盖 Android 库项目资源文件

标签 android android-library

基于以下链接:

Best practice: Extending or overriding an Android library project class

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

Android 库 (AAR) 中的类和资源是可覆盖的。覆盖 Assets 文件怎么样?在我的 AAR 文件中,我有一个名为 first.xml 的 Assets 。我想在我的 android 项目中创建我自己的 first.xml 来覆盖我的 AAR 中的文件。我该怎么做?

最佳答案

这是我的测试结果。

这是我在 AAR 中的 Assets /:

-assets/
 -a.xml
 -b.xml

这是我的 android 项目中的 Assets /,它依赖于上面的 AAR:

-assets/
 -b.xml
 -c.xml

我的 APK 中生成的 asset/如下:

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

关于android - 覆盖 Android 库项目资源文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62115925/

相关文章:

android - 如何测试 Retrofit2 + RxJava2 api 调用?

android - 更新到 Firebase Android 版本 15.0.0,将用户注销

android - 不小心删除了android依赖项文件夹

android - 在我的 Android 项目中引用 Facebook SDK

java - 不能继承final类

Android _ import android.support.v7.graphics 无法解决?

Android:将标题 View 添加到 ExpandableListView 时出现 ClassCastException

android - Retrofit2 - 如何只缓存特定的 API 调用

android - 如何在 View 寻呼机中从 fragment 2 而不是 fragment 1 开始

java - 将现有应用程序转换为库