简体   繁体   English

如何依赖另一个Gradle模块中的特定类或包?

[英]How to depend on specific class or package in another Gradle module?

I have two gradle modules, :app and :backend . 我有两个gradle模块:app:backend The backend contains some classes that I need in :app . 后端包含一些我需要在:app So normally I would add compile project(':backend') to my app module's dependencies. 因此,通常我会将compile project(':backend')到应用模块的依赖项中。

However, this adds all of backend and its dependencies to :app . 但是,这会将所有后端及其依赖项添加到:app Is there any way to tell gradle to add only specific classes or packages (and their dependencies) from :backend to :app ? 有什么办法告诉gradle从:backend:app 添加特定的类或包(及其依赖项)

EDIT: :backend is a AppEngine module, which contains a whole host of duplicate google dependencies that clash with my android app when I don't use the android-endpoints configuration. 编辑:: :backend是一个AppEngine模块,其中包含大量重复的Google依赖项,当我不使用android-endpoints配置时,这些依赖项与我的android应用程序发生冲突。

For removing all the transitive dependencies you can 要删除所有传递依赖项,您可以

compile (project(path: ':backend', configuration: 'android-endpoints')) {
  transitive = false
}

For ignoring some of them 因为忽略了其中一些

compile (project(path: ':backend', configuration: 'android-endpoints')) {
  exclude(group: 'some.group', module: 'some.module')
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法构建依赖于其他模块的gradle - Unable to build gradle that depend on other module 如何仅针对我的库模块/包获取特定于包的崩溃报告/数据(在某些应用程序中通过gradle依赖关系实现) - How do I obtain package specific crash report/data only for my library module/package (implemented in some Application via gradle dependency) Gradle:如何具有“模拟” buildType取决于另一个android库项目的“模拟” buildType? - Gradle: How to have a 'mock' buildType depend on a 'mock' buildType of another android library project? 如何在 android gradle 中排除特定的 class? - How to exclude specific class in android gradle? 将对象转换为特定类取决于何时调用 - cast an object into specific class depend on when called 动态功能模块是否可能依赖于另一个动态功能模块? - Is it possible for a dynamic feature module to depend on another dynamic feature module? Gradle中的Android模块特定库 - Android Module specific libraries in Gradle Gradle,如何从依赖项jar文件中排除类/包? - Gradle, how to exclude a class/package from dependency jar file? 模块如何使用Gradle多模块使用另一个模块的资源 - How module can use resources of another module using gradle multi-module Android Gradle 在另一个模块中包含模块依赖项 - Android Gradle include module dependencies in another module
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM