为什么谷歌建议复制库到你的树? [英] Why do Google recommend copying libraries into your tree?

查看:116
本文介绍了为什么谷歌建议复制库到你的树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌的的href="http://developer.android.com/google/play-services/setup.html" rel="nofollow">指令(例如)说:

Google's instructions for using the Play Service API (for example) say:

在/演员/谷歌/ google_play_services / libproject /谷歌播放services_lib库项目复制到源代码树,你保持你的Andr​​oid应用程序的项目。

Copy the /extras/google/google_play_services/libproject/google-play-services_lib library project into the source tree where you maintain your Android app projects.

注意:您要引用您复制到你的源代码库中的副本树,你不应该从Android SDK目录引用该库

Note: You should be referencing a copy of the library that you copied to your source tree—you should not reference the library from the Android SDK directory.

这似乎是丑陋,我 - 为什么从SDK目录中不能引用呢?是否有一些技术上的原因?或者是让你有明确的控制,当它得到提升呢?

This seems ugly to me - why not reference it from the SDK directory? Is there some technical reason for this? Or is it so that you have explicit control over when it gets upgraded?

推荐答案

我想指出的是,这完全是一个Eclipse的限制,这的确是丑陋的。

I'd like to point out that this is entirely a limitation of Eclipse, and it is indeed ugly.

现在的问题是,这个库包含的资源除了源$ C ​​$ C。 Eclipse的只能处理打包为jar文件,其中,对于Android的发展而言,不能包含的资源库。

The problem is that this library contains resources in addition to source code. Eclipse can only deal with libraries packaged as jar files, which, for the purposes of Android development, cannot contain resources.

因此​​,为了使图书馆的资源被编译到应用程序中,该库的源$ C ​​$ C,所拥有的资源,必须添加到您的项目。

So, in order for the library's resource to be compiled into the application, the library's source code, with the resources, must be added to your project.

如果你移动你的编译版本的Maven,并使用IDE的理解的Maven,那么你可以编译一个包含资源作为一个'apklib一库,并把它作为一个外部库,在类似的方式jar文件。

If you move your build to Maven, and use an IDE that 'understands' Maven, then you can compile a library that contains resources as an 'apklib', and treat it as an external library, in a manner similar to a jar file.

新摇篮 - 基于构建系统是建立在Maven的原语,但使用不同的格式,对于这一点,AAR。我们希望,它最终也将支持apklib这样的Maven构建和摇篮建立可以互操作。

The new Gradle-based build system is built on Maven primitives, but uses a different format for this, 'aar'. Hopefully, it will eventually also support apklib so that Maven builds and Gradle builds can inter-operate.

我刚刚通过行使一个Android应用程序转换为Maven构建,包括使用一些apklibs的去了。我可以告诉你的Eclipse与m2eclipse插件不处理apklibs正常。两者的IntelliJ和新的谷歌Android工作室(基于的IntelliJ)做处理apklibs没有问题。

I just went through the exercise of converting an Android application to a Maven build, including the use of some apklibs. I can tell you that Eclipse with the m2eclipse plugin does not handle apklibs properly. Both IntelliJ and the new Google Android Studio (based on IntelliJ) do handle apklibs with no issues.

这篇关于为什么谷歌建议复制库到你的树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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