如何将Android Studio中库项目存储在一个单独的git仓库? [英] How to include library projects in Android Studio that are stored in a separate git repository?

查看:646
本文介绍了如何将Android Studio中库项目存储在一个单独的git仓库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中,可以添加到库项目作为一个依赖添加到您的Andr​​oid项目,但保留在单独的Git仓库库项目和Android项目。

In Eclipse it is possible to add a library project as a dependency to your Android project but maintain the library project and Android project in separate git repositories.

我们的想法是,你可能有一个不断被一些程序员建立了新功能和存储在其自己的存储库库项目。如果我是这个库项目添加到一个新的Andr​​oid Studio项目,我将无法更新的最新变化库项目,因为Android的工作室,使库项目的副本,并将其放置到你的Andr​​oid项目。

The idea is that you might have a library project that is constantly being built up with new features by a number of programmers and stored in its own repository. If I were to add this library project to a new Android Studio project I won't be able to update the library project with the latest changes because Android Studio makes a copy of the library project and places it into your Android project.

必须有某种方式来保持Android项目和Android Studio中单独库项目。有没有人成功地做到这一点?

There must be some way to maintain the Android project and the library project separately in Android Studio. Has anyone managed to do this?

推荐答案

您可以将您的库项目作为一个模块depencency,所以它会自动同步。首先,你需要导入库作为一个新的模块项目:

You can add your library project as a module depencency, so it will be synced automatically. First you need to import the library as a new module into your project:

文件>导入模块>选择您的库源文件夹

然后添加该模块为项目依赖关系:

Then you add this module as a project dependency:

文件>项目结构>模块>选择您的项目模块>依赖> + GT;模块依赖>选择您的库模块

这篇关于如何将Android Studio中库项目存储在一个单独的git仓库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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