Android Gradle插件如何处理库中的冲突资源? [英] How does the Android Gradle plugin handle conflicting resources in libraries?

查看:515
本文介绍了Android Gradle插件如何处理库中的冲突资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个依赖两个Android库的Android应用程序项目。两个Android库指定具有相同资源ID的两个资源。在旧的Ant构建系统中,库的优先级在project.properties文件中指定,但在Gradle构建系统中未使用此文件。

I have an Android application project that depends on two Android libraries. The two Android libraries specify two resources with the same resource ID. In the old Ant build system, the priority of libraries was specified in a project.properties file, but such a file is not used in the Gradle build system.

尽管资源合并 doc解释资源的优先级和合并过程即构建类型,产品风味,应用程序项目和库项目之间的冲突,但它没有解释当两个库(没有共同的依赖关系)在单个项目中合并时发生的情况。在构建过程的合并过程中,Android Gradle插件如何确定哪个库的资源具有更高的优先级?

Although the Resource Merging doc explains the priorities and merge process for resources that conflict between build types, product flavors, application projects, and library projects, it does not explain what occurs when two libraries (who have no common dependencies) are merged in a single project. During the merge process of the build process, how does the Android Gradle plugin determine which library's resource has a higher priority?

推荐答案

并不是为图书馆资源指定优先级的方法。

There is not a way to specify a priority for the library's resources.

您只能使用

android {
  resourcePrefix 'mylib_'
}

这篇关于Android Gradle插件如何处理库中的冲突资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆