Android Studio External Library Projects

I am switching from Eclipse to android studio, and this is my setup in eclipse: I have several Android application projects, depending on several library projects (some common) in the same workspace. In the Android studio, I first started creating a project for each application, but quickly realized that I would have to have library projects as modules in every project that uses them. This would mean duplicating library projects and including them in each application, which would be too redundant and would require the support of multiple copies of the libraries.

So, I switched to ensure that all my applications and libraries are modules in one project. This works to create, but creates other problems, such as version control problems, as each module lives in a separate version control repository.

What is the cleanest way to configure? And the real question is: can I have separate projects in AS that use the same external library projects?

+5
android eclipse android-studio project
Feb 06 '14 at 2:07
source share
1 answer

Note

With the release of Android Studio 0.5.0, this answer is deprecated, but I will leave it below for reference. For more detailed instructions, see How to split a single library source across multiple projects.




In Android Studio, it is difficult to have projects with a common library, because at present it is a limitation that all modules in the project must live in the same root folder; it seems that you learned about this when you tried to solve your problem by making one large project that includes everything. We are working on an attempt to remove this restriction.

The best answer right now is to make library modules separate projects and publish them to your local Maven repository, and so that dependent projects get them out of this repo. This means that, unfortunately, you cannot work with the sources of your application + library module from the context of one project. The biggest drawback is that the source attachments for these library modules do not work yet, so if you are trying to debug your application, it will be difficult for you to enter the code in the libraries.

I know this is not a very good answer, but at this stage in the evolution of Android Studio, this is probably the best we can do. We know that yours is a fairly common precedent, and for us this is a priority.

+3
Feb 06 '14 at 17:08
source share



All Articles