Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tips for optimizing build time in Android studio?

I have been having horrible build time from android studio and I wanted to know if you have any tips for optimizations. Here is a bit of details on the app I'm currently working on:

  • 65k function limit issue, using the latest multidex fix from the support pkg
  • Uses around 10-15 Libraries
  • Uses 1-2 native libs (.so)
  • Tried using the pre-dex trick, results varies.
  • Build time before integrating twitter fabric ~ 1m30sec
  • Build time after integrating twitter fabric 4m30sec - 14m30sec

Hardware/Software spec:

  • i7 4240
  • 16GB RAM
  • 250GB SSD

Any tips, comments are most welcomed :)

EDIT 1

Added profiling results:

<div class="tab" id="tab0">
<h2>Summary</h2>
<table>
<thead>
<tr>
<th>Description</th>
<th class="numeric">Duration</th>
</tr>
</thead>
<tr>
<td>Total Build Time</td>
<td class="numeric">8m44.29s</td>
</tr>
<tr>
<td>Startup</td>
<td class="numeric">1.813s</td>
</tr>
<tr>
<td>Settings and BuildSrc</td>
<td class="numeric">0.038s</td>
</tr>
<tr>
<td>Loading Projects</td>
<td class="numeric">0.009s</td>
</tr>
<tr>
<td>Configuring Projects</td>
<td class="numeric">5.889s</td>
</tr>

http://jsfiddle.net/gp6o04dL/

like image 585
Vannen Avatar asked Oct 20 '22 21:10

Vannen


1 Answers

You may try with...

File -> Settings -> select Gradle -> Global Gradle Settings -> offline work

like image 132
Amitabha Biswas Avatar answered Oct 29 '22 15:10

Amitabha Biswas