title: Why does assembleDebug takes much longer then project build and how to optimize it?
body: <p>I've been dealing with gradle build time in Android Studio recently. I've managed to decrease the build time from about 3 mins to 10 seconds by removing some dependencies, but here's the thing:</p>
  
  <p>When I rebuild project it takes about 10 seconds:</p>
  
  <pre><code>15:13:43 Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources]
  15:13:54 Gradle build finished in 11s 596ms
  </code></pre>
  
  <p>However when I launch the app, it takes a lot longer, about a minute:</p>
  
  <pre><code>15:15:09 Executing tasks: [:app:assembleDebug]
  15:15:58 Gradle build finished in 49s 676ms
  </code></pre>
  
  <p>What is the cause of such big difference? Is this still because of the large amount of gradle dependencies or something else? Can I reduce the build time somehow?</p>