我在 Intellij IDEA 中有一个使用经典格式的 android 项目,我想使用 gradle 将其移植到 Android Studio。
我的项目由多个模块组成,它们之间存在依赖关系:
/root
module1/
module2/
appModule/
module1
和 module2
是库模块。 appModule
是实际的 android 应用程序,目前正在使用 module1
和 module2
作为依赖项。
我如何使用 gradle 实现这一目标?
我目前每个模块都有一个 gradle 文件,但我在 appModule/build.gradle
中遇到问题,无法引用其他模块。我猜我需要根目录中的 build.gradle
吗?
最佳答案
根 build.gradle
文件是可选的。
你需要的是在你的根项目中有一个 settings.gradle
文件并指定所有模块,然后在你的 appModule 的 build.gradle
文件中,添加:
dependencies {
compile project(':module1')
// others modules goes here...
}
关于android - 将多模块 Android Intellij 项目移植到 Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31444436/