摇篮建立了多项目结构很慢 [英] Gradle builds really slow with a multi-project structure

查看:378
本文介绍了摇篮建立了多项目结构很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与摇篮含有大约140个项目/库的多项目设置构建时,构建时间耗时1小时22分钟。我是用 - 并行。而我们的ANT构建时间不超过20分钟不平行的建设。

下面正是我所做的。

  ./ gradlew干净
./gradlew打造--parallel
 

我做了一个小测试,好像德兴走的时间最长。有没有办法让摇篮进程重新使用它已经dexed的东西吗?如果库已经建成,它应该重新使用已经dexed库。

我看到了选项 - 没有重建,但是当我运行与该选项它说了以下

 文件'/path/to/project/build/libs/project.aar'财产'捆绑'指定不存在。
 

我替换的文件路径和项目名称与通用的东西。

使用摇篮1.9 RC-3


信息(2014年1月15日):

preDexDebug preDexRelease 花了很长的时间对每一个项目。远远高于任何其他任务更长的时间。


进展(2014年1月15日):

好了,现在,我把 preDexLibraries = FALSE 到所有的 build.gradle 文件。不过,我还是想知道一个集中式的地方,我可以把那项,它影响所有其他 build.gradle 文件。

不过,现在 dexRelease dexDebug 正在很长的时间。有什么办法,我可以告诉版本只做了 dexDebug dexRelease 并跳过另一个<? / P>


进展(2014年1月15日):

使用 assembleDebug 工作。但是,它仍然好像它是不能重新使用已经dexed库。由于德兴仍然采取永远。大约需要为每个项目一分钟。 有没有办法让摇篮重新使用已经dexed库?还是有不同的原因,构建仍然需要大约一个小时?我们的ANT过程用时不到15分钟。

解决方案

做一个洁净实际上是删除已经predexed库。
由于在这个线程建议 你可以节省一些时间洁净构建禁用predexing(因为在未来建设,他们将被删除):

安卓{   dexOptions {     preDexLibraries = FALSE   } }

When building with gradle on a multi-project setup containing roughly 140 projects/libraries, the build time took 1 hour and 22 minutes. And i was using --parallel. And our ANT build takes less than 20 minutes without parallel building.

Here is exactly what i did.

./gradlew clean
./gradlew build --parallel

I did a little testing it seems like the dexing is taking the longest amount of time. Is there a way to get the gradle process to re-use the stuff it has already dexed? If the libraries have already been built, it should re-use the already dexed libraries.

I saw the option --no-rebuild, but when i run with that option it says the following

File '/path/to/project/build/libs/project.aar' specified for property 'bundle' does not exist.

I replaced the file path and project name with generic stuff.

Using Gradle 1.9-rc-3


Additional information(15 Jan 2014):

preDexDebug and preDexRelease took a VERY long time on each project. Much longer than any other task.


Progress(15 Jan 2014):

Ok, for now, i put preDexLibraries = false into all of the build.gradle files. However, i still would like to know a centralize place that i can put that entry and it affect all the other build.gradle files.

However, now dexRelease and dexDebug are taking a long time. Is there any way that i can tell the build to only do the dexDebug or dexRelease and skip the other one?


Progress(15 Jan 2014):

Using assembleDebug worked. However, it still seems like it is not re-using the already dexed libraries. Because dexing is still taking forever. It takes about a minute for each project. Is there a way to get gradle to re-use the already dexed libraries? Or is there a different reason why the build is still taking about an hour? Our ANT process takes less than 15 minutes.

解决方案

Doing a clean you actually delete the already predexed libraries.
As suggested in this thread you could save some time on clean builds by disabling predexing (because at the next build they will be deleted):

android {
  dexOptions {
    preDexLibraries = false
  }
}

这篇关于摇篮建立了多项目结构很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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