Tips for optimizing build time in android studio?

I had terrible build time from android studio and wanted to know if you have any optimization tips. Below is a detailed description of the application I'm currently working on:

  • 65k feature limitation issue using latest multidex fix from pkg support
  • Uses about 10-15 libraries.
  • Uses 1-2 own libs (.so)
  • I tried using the pre-dex trick, the results vary.
  • Build time before twitter integration ~ 1m30sec
  • Assembly time after integration of the tweeter fabric 4m30sec - 14m30sec

Hardware / Software Specification:

  • i7 4240
  • RAM 16 GB
  • 250 GB SSD

Any tips, comments are most welcome :)

EDIT 1

Profiling results added:

<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/

+5
source share
2 answers

You may try...

File -> Settings -> select Gradle -> Global Gradle Settings -> battery life

+2
source

You can do a lot, one of them disables Crashlytics for debugging taste.
In build.gradle:

 android { ... buildTypes { debug { ext.enableCrashlytics = false } } 

In the class where you initialized the fabrics:

 Crashlytics crashlyticsKit = new Crashlytics.Builder() .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) .build(); Fabric.with(this, crashlyticsKit); 

Hope this helps.

Link: https://developer.android.com/studio/build/optimize-your-build.html

+1
source

Source: https://habr.com/ru/post/1208564/


All Articles