Android的编译速度很慢(使用Eclipse) [英] Android compilation is slow (using Eclipse)

查看:398
本文介绍了Android的编译速度很慢(使用Eclipse)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我更改任何.java文件,并建立,编译需要16秒。我不明白为什么要这么慢!?

When I change any .java file and build, the compilation takes 16 seconds. I don't understand why it should be so slow!?

我启用了详细的输出为Andoroid。

I enabled verbose output for Andoroid.

Window > Preferences > Android > Build output > Verbose.

结果输出(控制台>安卓)是:

The result output (Console > Android) is:

[19:46:10] Refreshing resource folders.
[19:46:10] Starting incremental Pre Compiler: Checking resource changes.
[19:46:10] Nothing to pre compile!
[19:46:10] Starting incremental Package build: Checking resource changes.
[19:46:10] ignored resource ...\bin\.\classes.dex
[19:46:10] processing ...\A.class
[19:46:10] processing ...\B.class
    ...
[19:46:21] processing com/google/inject/util/Providers.class...
[19:46:21] processing com/google/inject/util/Types.class...
[19:46:24] Using default debug key to sign package
[19:46:24] Packaging ...\bin\resources.ap_
[19:46:24] Packaging classes.dex
    ...
[19:46:25] Packaging ...\annotations.jar
[19:46:25] Build Success!
[19:46:25] Refreshing resource folders.
[19:46:25] Starting incremental Pre Compiler: Checking resource changes.
[19:46:26] Nothing to pre compile!

的.class文件的处理了14秒。它处理的所有文件,甚至从链接的所有.jar文件。我觉得有些东西错放在这里,因为只有一个.java文件被更改。

The "processing" of .class files took 14 seconds. And it "processed" all files, even from all .jar files linked. I think some thing wrong goes here, as only one .java file was changed.

我能做些什么来提高编译速度?

What can I do to improve the compilation speed?

推荐答案

我觉得这里有一个误解。正如你所说,只有修改的类被重新编译(由Eclipse在毫秒之内);在那之后,但是,ADT插件需要每编译的类并将其转换的Dalvik的字节code通过DX工具格式。这个过程的输出是单个文件,classes.dex,它包含了所有的类应用程序,包括那些从引用的库来了。这最后一个翻译的步骤是一个需要更长的时间,因为它是真正的优化很差:ADT插件不缓存任何东西,它只是retranslates每个班级每个版本(和它的痛苦的缓慢)。对于中这得到很无奈......我希望谷歌将提高,在未来的ADT / SDK发布大项目。

I think there's a misunderstanding here. As you say, only the modified classes are recompiled (by Eclipse in a matter of milliseconds); after that, however, the ADT plugin takes every compiled class and translates it into Dalvik's bytecode format via the dx tool. The output of this process is a single file, classes.dex, which contains all the classes in your application, including the ones coming from referenced libraries. This last "translation" step is the one that takes longer because it's really poorly optimized: the ADT plugin doesn't cache anything, it just retranslates every class at every build (and it's painfully slow). For medium to big projects this gets really frustrating... I hope Google will improve that in a future ADT/SDK release.

这篇关于Android的编译速度很慢(使用Eclipse)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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