加入谷歌番石榴到Android项目 - 显著减慢构建 [英] Adding Google Guava to Android project - significantly slows down the build

查看:221
本文介绍了加入谷歌番石榴到Android项目 - 显著减慢构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在加入谷歌番石榴R09到​​我们的Andr​​oid项目的建造时间显著的增加,特别是DEX生成阶段。据我所知,DEX代通吃我们班+我们靠大家罐子并将其转换成DEX格式。番石榴约1.1MB一个pretty的大罐子

After adding Google Guava r09 to our Android project the build time increased significantly, especially the DEX generation phase. I understand that DEX generation takes all our classes + all jars we depend on and translates them to DEX format. Guava is a pretty big jar around 1.1MB

  1. 也可以是事业,为构建放缓?
  2. 有没有什么可以做,以加快这?

P.S。通常我构建的IntelliJ,但我也试过用Maven构建 - 同样的结果

P.S. Usually I build from Intellij, but I also tried building with Maven - same results.

感谢

亚历

推荐答案

有关它的价值,我的直觉是,这不是原因。很难需要很长的时间做以字节code区区1.1MB任何东西;我从来没有注意到DEX采取任何显著的时间。但是让我们假设它是问题的只是就事论事。

For what it's worth, my gut is that this isn't the cause. It's hard to take a long time doing anything with a mere 1.1MB of bytecode; I've never noticed dex taking any significant time. But let's assume it is the issue for sake of argument.

如果它很重要的话,你也许可以切片番石榴的.jar 删除全包,你不要使用。它是由数块不一定是所有相互关联的

If it matters enough, you could probably slice up the Guava .jar to remove whole packages you don't use. It is composed of several pieces that aren't necessarily all inter-related.

我不认为这会加快速度,但也许值得一提的是:如果你运行构建通过Proguard的(现在捆绑了SDK优化器),它可以删除未使用的类之前,你要DEX(和,做了字节code一堆其他伟大的优化)。但是,当然,这可能是处理中需要更长的时间本身就比DEX-ING。

I don't think this is going to speed things up, but maybe worth mentioning: if you run the build through Proguard (the optimizer now bundled with the SDK), it can remove unused classes before you get to DEX (and, do a bunch of other great optimization on the byte code). But of course that process probably takes longer itself than dex-ing.

这篇关于加入谷歌番石榴到Android项目 - 显著减慢构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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