3

I am trying to figure out why our Gradle build is so slow. Currently each time you hit build with no changes the build time is around 45 seconds. This is a single module project. I have turned on profiling and most of the time is spent on :app:dexDebug. We are build using Gradle 2.8 and my dex options are as follows:

dexOptions {
        preDexLibraries = false
        incremental true
        javaMaxHeapSize "4g"
    }

From the profile report:

:app 43.957s (total) 
:app:dexDebug 28.727s 

Is there a way to speed this up? Why does dex have to be rebuilt each time?

4xMafole
  • 479
  • 1
  • 8
  • 20
Nikoli
  • 147
  • 12

1 Answers1

0

This might shed some light:

http://tools.android.com/tech-docs/instant-run

Gradle build slow on transformClassesWithDexForDebug

https://code.google.com/p/android/issues/detail?id=187443&q=attachments%3D0&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

Try disabling data binding:

  dataBinding {
         enabled = true
  }

Also try

 ./gradlew  assembleDebug --profile
4xMafole
  • 479
  • 1
  • 8
  • 20
KarolDepka
  • 8,318
  • 10
  • 45
  • 58