title: Optimizing build time in Android Studio
body: <p>I've tried building it:</p>
  
  <ul>
  <li>parallel (helps a bit)</li>
  <li>daemon=true</li>
  <li>preDexLibraries true/false ( no big difference )</li>
  <li>incremental true</li>
  <li>offline</li>
  </ul>
  
  <p>It takes >40s EVERY time. It doesn't matter if I change anything or not. Building it after "gradle clean" takes >50s.</p>
  
  <p>I hope that I'm doing something wrong. Eclipse/ant could build consecutive builds WITH CHANGES in &lt;10s.</p>
  
  <p>Any help how to bring this &lt;10s appreciated.
  Yes, we have a lot of modules, some jar libraries, some maven dependancies. Still don't get why would it take >40s for two consecutive builds with no changes.</p>
  
  <p>Gradle used: 2.2.1
  Android studio: not really relevant, usually building it only with Gradle.</p>
  
  <p>EDIT: adding some profiling logs.</p>
  
  <blockquote>
    <p>:app:dexProjDebug                      22.541s</p>
    
    <p>:app:shrinkProjDebugMultiDexComponents 4.279s</p>
    
    <p>:app:compileProjDebugJava              3.478s</p>
    
    <p>:app:packageProjDebug                  2.591s</p>
    
    <p>:app:processProjDebugResources         2.590s</p>
    
    <p>:app:packageAllProjDebugClassesForMultiDex 2.536s</p>
    
    <p>:app:createProjDebugMainDexClassList   2.126s</p>
  </blockquote>