Android Studio - 在不复制文件的情况下创建模块? [英] Android Studio - Creating Modules without copying files?

查看:28
本文介绍了Android Studio - 在不复制文件的情况下创建模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Android Studio 中创建具有依赖项的项目.我知道如何通过添加模块来链接项目.

I'm creating projects with dependencies in Android Studio. I know how to link projects by adding modules.

但我意识到导入模块"会在项目中创建 libProject 的副本.

But I realized that 'importing modules' create a copy of the libProject inside the project.

有什么办法可以防止吗?像一个外部模块"?

Is there a way to prevent that ? Like an 'external module' ?

由于我负责这两个项目,我希望能够将更改推送到 libProject Repo,而无需在文件夹之间复制粘贴文件.

Since i'm in charge of both project, I want to be able to push changes to the libProject Repo, without having to copy paste files between folders.

谢谢

推荐答案

是的,你可以做到.该模块需要为其设置一个 Gradle 构建文件.如果是这样,那么在您要链接到它的项目中,将其添加到项目根目录的 settings.gradle 文件中:

Yes, you can do it. The module needs to have a Gradle build file set up for it. If it's got that, then in the project you're linking to it, add this to the settings.gradle file at the project root:

include ':libraryName'
project(':libraryName').projectDir=new File('/path/to/library')

您在第二行中指定的路径是包含库的 build.gradle 文件的目录的路径.路径可以是相对的,也可以是绝对的.

where the path you specify in the second line is the path to the directory containing the library's build.gradle file. The path can be relative or absolute.

这篇关于Android Studio - 在不复制文件的情况下创建模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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