【问题标题】:porting multi-module Android Intellij Project to Android Studio将多模块 Android Intellij 项目移植到 Android Studio
【发布时间】:2015-07-16 02:30:38
【问题描述】:

我在 Intellij IDEA 中有一个使用经典格式的 android 项目,我想使用 gradle 将其移植到 Android Studio。

我的项目由多个模块组成,它们之间存在依赖关系:

/root
  module1/
  module2/
  appModule/

module1module2 是库模块。 appModule 是实际的 android 应用程序,当前使用 module1module2 作为依赖项。

如何使用 gradle 实现这一目标?

我目前对每个模块都有一个 gradle 文件,但我在 appModule/build.gradle 中遇到了麻烦,使其引用其他模块。我猜我在根目录中需要一个build.gradle

【问题讨论】:

    标签: android android-studio intellij-idea gradle


    【解决方案1】:

    build.gradle 根文件是可选的。

    您需要的是在您的根项目中有一个settings.gradle 文件并指定所有模块,然后在您的appModule 的build.gradle 文件中添加:

    dependencies {
      compile project(':module1')
      // others modules goes here...
    }
    

    【讨论】:

    • 我现在面临另一个问题,我已经问过another question。如果您能看一下,我将不胜感激。
    猜你喜欢
    • 2015-06-01
    • 2022-12-30
    • 2020-07-08
    • 1970-01-01
    • 2013-11-03
    • 1970-01-01
    • 2013-06-23
    • 2013-09-29
    • 1970-01-01
    相关资源
    最近更新 更多