5

I've updated Android Gradle Plugin to 3.3.2 and faced with the issue that build time is dramatically slower in comparison with 3.0.1.

DX takes 1min 40s - 2min 20s for clean build and around 1 min for rebuild when D8 takes 9min for clean build and around 7min for rebuild

After some investigation I found out that D8 compiler is turned on by default since 3.1.+ and it can be turned off, but from 3.3.+ it won't be possible.

This is gradle.properties

org.gradle.jvmargs=-Xmx4608m
org.gradle.caching=true
org.gradle.parallel=true
android.enableD8=true
android.enableD8.desugaring=true

Also

minifyEnabled false
shrinkResources false

--scan shows that transformClassesWithDexBuilder takes 5-7 minutes to finish, is there any way how to increase build speed without turning off D8?

Harshal Benake
  • 2,391
  • 1
  • 23
  • 40
Sergey Zabelnikov
  • 1,855
  • 1
  • 14
  • 24
  • Even after I updated to 3.3.2 the problem still exists, even small change takes around 2 minutes to compile, transform and install – Sergey Zabelnikov Mar 13 '19 at 09:42
  • Although D8 by design is doing more then DX increase from 2min to 9 min is not typical. On my 50+ kloc size project D8 is actually faster then previous build tools. Most likely your slow build issue is not related to D8 directly but rather was intensified by it. I recommend you to follow regular android gradle build speed improvement tips. – Sergii Pechenizkyi Mar 13 '19 at 16:40
  • 1
    You can increase build speed *dramatically* by using the `command line` [see this](https://stackoverflow.com/questions/47167769/hello-world-android-app-with-as-few-files-as-possible-no-ide-and-text-editor/47251607#47251607). – Jon Goodwin Mar 15 '19 at 17:02
  • Depending on how much RAM you have, 4608m may be too much for Xmx. You could try a smaller value to avoid memory thrashing. – Leo supports Monica Cellio Mar 19 '19 at 14:45

0 Answers0