android - 将多模块 Android Intellij 项目移植到 Android Studio

标签 android android-studio intellij-idea gradle

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

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

/root
  module1/
  module2/
  appModule/

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

我如何使用 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/

相关文章:

android - 应用程序启动期间的白色背景

java - 通过Web服务从服务器向客户端发送pdf文件

android - 使用 AndroidStudio(版本 3.6.1)中缺少的 AndroidX Artifact 复选框,创建新项目时?

scala - 如何阻止 Intellij 创建 src/main/java 和 src/main/scala-x 文件夹?

intellij-idea - 有没有办法在 Micronaut 中禁用原生图像支持?

android - 关于 Androids App-Widgets 的一些困惑

android - 如何将.doc文件从sd卡导入应用程序数据库?

android - 设计在 Android Studio 预览中完美显示但在真实设备中不显示

安卓 : Application does not seek into layout-land when the device changes his orientation

java - 无法使用IntelliJ在Docker容器内调试Websphere Application Server