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

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

问题描述:

是否可能有2个应用程序模块(在gradle文件的开头带有 apply插件:'com.android.application'),并且其中一个模块依赖于另一个模块?

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?

因此,模块A对模块B具有依赖关系,并且两者都是应用程序.

So module A would have a dependency to module B and both would be applications.

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

我可以轻松地添加此依赖项,并且没有出现错误/警告,但是我仍然无法访问moduleB中的源文件.Android Stduio仍然建议我将依赖项添加到moduleB",当我这样做时,只需重新同步gradle即可.

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. Android Stduio still suggest me to "add dependency to moduleB" and when I do it just re-syncing gradle and nothing happen.

我试图包括对库模块的依赖关系,并且此方法运行良好.我们不能在两个(或更多)应用程序模块之间添加依赖关系吗?

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?

是否可能有2个应用程序模块(在gradle文件的开头带有Apply插件:"com.android.application"),并且其中一个模块依赖于另一个模块?

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?

不,抱歉.

我们不能在两个(或更多)应用程序模块之间添加依赖关系吗?

Can't we add dependency between two (or more) applications modules?

正确-不支持.