Android gradle increases exponential increase time

The build time for Gradle My Gradle is usually about 12 seconds, but after creating about 10-20 units, it starts to increase immediately, exponentially: 30 seconds, 50 seconds, 2 minutes, 5 minutes, etc. before exiting the memory.

Healthy build:

:app:compileDev21DebugJavaWithJavac 4.783s :app:transformClassesWithRealmTransformerForDev21Debug 3.011s :app:transformClassesWithDexForDev21Debug 2.133s :app:compileRetrolambdaDev21Debug 1.325s :app:packageDev21Debug 0.997s :app:processDev21DebugResources 0.703s 

After 10 to 20 of them, it begins to increase:

 :app:transformClassesWithDexForDev21Debug 39.172s :app:compileDev21DebugJavaWithJavac 34.221s :app:packageDev21Debug 9.922s :app:transformClassesWithRealmTransformerForDev21Debug 8.353s :app:compileRetrolambdaDev21Debug 3.120s :app:fabricGenerateResourcesDev21Debug 1.376s 

As you can see, each task increases in time.

I am using Android Studio 2.2.2, but I have had a problem with the last three versions. Gradle 2.14.1. This is probably due to our project. I am using a Mac, my Windows colleague has the same in the same project. If I stop AS, kill Java and run AS again, which solves it for a while.

I do not use the Jack compiler (yet).

To be clear: my build time is NOT generally slow: 13 seconds is fine. This is not a duplicate of all "slow build time" questions. Only after 10-20 builds does the assembly time increase exponentially with each assembly.

Update: make Gradle build "offline" did not help. Using gradle -3.1-all.zip "(distributionUrl in grade-wrapper.properties) didn't help either.

Has anyone had this problem and knows the solution?

+5
source share
2 answers

This is fixed from the day I removed Fabric (CrashLytics) and replaced it with FireBase Crashes. The fabric probably caused it, but I'm not 100% sure.

-1
source

I experienced (and for some reason still encountered) the same problem. There are some fixes you can try.

1 - Make Gradle build offline.

2 - Install Gradle on the machine and use the local installation along with the offline work tested in Android Studio instead of using a shell that connects to the proxy server and takes longer to create the Studio cache.

I followed this and this article, and it helped me not substantially, but enough to get almost 6.7 hours of continuous development on 8 GB of memory, then I have to Invalidate and reboot .

+1
source

Source: https://habr.com/ru/post/1259044/


All Articles