它是使用谷歌番石榴库Android开发一个好主意吗? [英] Is it a good idea to use Google Guava library for Android development?

查看:147
本文介绍了它是使用谷歌番石榴库Android开发一个好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我参与了Android应用程序的开发这是一个比较厚手机客户端的Web服务。这很大程度上与服务器通信,但也有很多内在的逻辑了。于是,我决定用谷歌番石榴库中的某些功能,以简化开发过程。这里是一个功能我很感兴趣的列表:不可变的集合,基地utils的,集扩展,函数式编程糖和成语( common.collect common.base ),基元水电费( common.primitives ),散列公用事业( common.hash ),并发utils的(期货和 AsyncFunction )。事情我不想在Android中使用: common.cache (见下面的问题), common.eventbus (我们有这更好的Andr​​oid特定库,如奥托),常见.IO (我们可以使用奥基奥为Android现在)。

我读了使用番石榴为Android可以显著减缓编译过程​​,也降低了整个运行时性能: 为性能与番石榴缓存(在这种情况下,它是合理的,并且没有必要利用番石榴的缓存为Android)和 <一href="http://stackoverflow.com/questions/7548038/adding-google-guava-to-android-project-significantly-slows-down-the-build">Adding谷歌番石榴到Android项目 - 显著减慢构建  

那么,是不是有效地使用番石榴库在Android项目或者这个库的设计是使用 仅适用于服务器端的开发,我需要用标准的解决方案去?任何的解释将是非常美联社preciated。

I am involved in the development of Android application which is a rather "thick" mobile client for a Web service. It heavily communicates with the server but also has a lot of inner logic too. So, I decided to use some features of Google Guava library to simplify development process. Here is a list of features I'm very interested in: immutable collections, base utils, collection extensions, functional programming sugar and idioms (common.collect and common.base), primitives utilities (common.primitives), hashing utilities (common.hash), concurrent utils (futures and AsyncFunction). Things I don't want to use in Android: common.cache (see question below), common.eventbus (we have better Android specific libs for this, such as Otto), common.io (we can use okio for Android now).

I read that using Guava for Android can significantly slow down compilation process and also decrease the whole runtime performance: Bad performance with Guava Cache (in this case it is reasonable and there is no need to use Guava's cache for Android) and Adding Google Guava to Android project - significantly slows down the build

So, is it efficient to use Guava library in Android project or this library is designed to be used only for the server-side development, and I should go with standard solutions? Any explanations will be very appreciated.

推荐答案

(太大意见,所以我发布一个答案。)我个人使用全番石榴库在每一个Java项目,当我没有的显著妥善异形的性能问题。如果你确实有,比如像Android的环境中存储的担忧,您可以使用 ProGuard的获得番石榴只有这些部位,你真正需要的。

(Too big for comment, so I post an answer.) Personally I use whole Guava library in every Java project and when I don't have significant and properly profiled performance problems. If you do have, for example, memory concerns like in Android environment, you can use ProGuard to get only these parts of Guava you really need.

此外,有使用番石榴许多Android应用程序 - 不仅是小的,即谷歌搜索和YouTube,它来自直接从谷歌。

Moreover, there are many Android apps using Guava - not only small ones, i.e. Google Search and Youtube, which come from directly from Google.

(你也应该看到兼容性注释。)

这篇关于它是使用谷歌番石榴库Android开发一个好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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