使用Gradle将应用程序模块依赖项添加到Android Studio中的另一个应用程序模块中 [英] Add application module dependency into another application module in Android Studio with Gradle

查看:69
本文介绍了使用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?

正确-不支持.

这篇关于使用Gradle将应用程序模块依赖项添加到Android Studio中的另一个应用程序模块中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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