简体   繁体   English

使用 Gradle 将应用程序模块依赖项添加到 Android Studio 中的另一个应用程序模块中

[英]Add application module dependency into another application module in Android Studio with Gradle

Is it possible to have 2 applications modules (with apply plugin: 'com.android.application' at the head of their gradle file) and one having a dependency over another?是否可以有 2 个应用程序模块(在其 gradle 文件的开头带有apply plugin: 'com.android.application' )并且一个依赖于另一个?

So module A would have a dependency to module B and both would be applications.因此,模块 A 将依赖于模块 B,并且两者都是应用程序。

dependencies {
    ...
    compile project(':moduleB')
}

I easily managed to add this dependency and no errors/warnings comes out but I still do not have access to source files inside moduleB.我很容易地添加了这个依赖项,没有出现错误/警告,但我仍然无法访问 moduleB 中的源文件。 Android Stduio still suggest me to "add dependency to moduleB" and when I do it just re-syncing gradle and nothing happen. Android Stduio 仍然建议我“向 moduleB 添加依赖项”,当我这样做时,只需重新同步 gradle,什么也没有发生。

I tried to include a dependency over a library module and this is working fine.我试图包含对库模块的依赖,这工作正常。 Can't we add dependency between two (or more) applications modules?我们不能在两个(或更多)应用程序模块之间添加依赖关系吗?

Is it possible to have 2 applications modules (with apply plugin: 'com.android.application' at the head of their gradle file) and one having a dependency over another?是否可以有 2 个应用程序模块(在其 gradle 文件的开头带有 apply plugin: 'com.android.application')并且一个依赖于另一个?

No, sorry.不,对不起。

Can't we add dependency between two (or more) applications modules?我们不能在两个(或更多)应用程序模块之间添加依赖关系吗?

Correct — that is not supported.正确 - 不支持。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM