Android的工作室外部库项目 [英] Android studio external library projects

查看:160
本文介绍了Android的工作室外部库项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从Eclipse中移动到Android的工作室,这是我建立在Eclipse: 我有几个Android应用程序的项目,这取决于几个库项目(某些共享)都在一个工作区。在Android的工作室我第一次开始创建每个应用程序项目,但很快就意识到,我必须有库项目,使用它们的每个项目中的模块。这将意味着复制库项目和包括它们中的每个应用程序,这是高度冗余的,需要维持的库的多个副本。

I'm moving from Eclipse to android studio and this is my set up in eclipse: I have several Android app projects, depending on several library projects (some shared) all within one workspace. In Android studio I first started creating a project per app, but quickly realized that I would have to have the library projects as modules within each project that uses them. This would mean duplicating the library projects and including them in each app, which is highly redundant and would require maintaining multiple copies of the libraries.

所以,我切换到有我所有的应用程序和库在同一个项目中的模块。该工程建设而造成的其他问题,如版本控制问题,因为每个模块住在一个单独的版本控制库。

So I switched to having all my apps and libraries as modules within the same project. This works for building but creates other problems such as version control issues since each module lives in a separate version control repository.

什么是有这个设置最彻底的方法?而真正的问题是,我可以在作为单独的项目共享相同的外部库项目?

What is the cleanest way to have this setup? And the real question is, can I have separate projects in AS that share the same external library projects?

推荐答案

注意

使用Android的工作室0.5.0的发布,这个答案已经过时了,但我会离开它如下,仅供参考。欲了解更多了最新的说明,请参阅<一href="http://stackoverflow.com/questions/22243269/android-studio-0-5-how-to-share-a-single-library-source-across-multiple-proje/22263065#22263065">Android 。工作室0.5 +:如何

With the release of Android Studio 0.5.0, this answer is obsolete, but I'll leave it below for reference. For more up-to-date instructions, see Android Studio 0.5.+: How to share a single library source across multiple projects

在Android的工作室,这是很难有共享库的项目,因为目前它是在一个项目中的所有模块都必须生活在同一根文件夹的限制;好像你发现了这一点,当你试图通过包括一切一个大项目,以解决你的问题。我们正在努力试图解除此限制。

In Android Studio, it's difficult to have shared library projects, because currently it's a limitation that all modules in a project must live under the same root folder; it seems like you found this out when you tried to solve your problem by making one big project that includes everything. We're working on trying to lift this limitation.

最好的答案,现在是让库模块单独的项目,并让他们发布到本地仓库,并有相关的项目,从回购中拉他们。这意味着你不能在你的应用程序+库模块源从单一项目的环境中工作,很遗憾。更加不利的是,对于那些库模块的源附件不能正常工作呢,所以如果你想调试你的应用程序,你就会有困难步入code在库中。

The best answer right now is to make the library modules separate projects and have them publish to a local Maven repository, and have the dependent projects pull them in from that repo. This means that you can't work on your app + library module sources from the context of a single project, unfortunately. A bigger disadvantage is that source attachments for those library modules doesn't work yet, so if you're trying to debug your app, you'll have difficulty stepping into code in the libraries.

我知道这是不是一个很大的答案,但现阶段的Andr​​oid Studio的进化,它可能是我们能做到的最好的。我们知道你是一个很常见的情况,这是我们的优先事项,以支持它。

I know this isn't a very great answer, but at this stage of Android Studio's evolution, it's probably the best we can do. We know yours is a fairly common use case, and it's a priority for us to support it.

这篇关于Android的工作室外部库项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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