如何在Android Studio中包含存储在单独的git存储库中的库项目?

问题描述:

在Eclipse中,可以添加一个库项目作为您的Android项目的依赖项,但是在单独的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.

你可能有一个图书馆项目不断地被许多程序员的新功能构建并存储在自己的存储库中。如果我将这个图书馆项目添加到新的Android Studio项目中,我将无法使用最新的更改来更新图书馆项目,因为Android Studio会将该图书馆项目的副本放入Android项目。

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 Studio中单独维护Android项目和库项目。有没有人设法这样做?

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

可以通过将git中的库作为子模块添加到应用程序项目中。我已经解释了这里的步骤: Android Studio,如何添加我自己的git仓库作为库项目(子模块)?

you can by adding the library from git as a submodule to your application project. i have explained the steps in here : Android Studio, how to add my own git repository as a library project(sub module)?