Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decreasing android studio 2.1 build time

Tags:

I was using android studio 1.5 earlier and i just upgraded to 2.1.But after the update my builds are taking much more time(from 15 sec to 2 min now)

Things I have tried as mentioned here

Enabled offline work in Settings

org.gradle.daemon=true
org.gradle.parallel=true

in gradle.properties file @ C:\Users\.gradle (Windows)

But still no difference. How can I reduce the build time?

like image 304
praticus Avatar asked May 16 '16 05:05

praticus


2 Answers

From official source:

Windows defender real time protection is causing instant run slow downs. Add your project folder to windows defender's list of exclusion.

The video (Instant Run - Deep dive) on the official documentation page for Instant Run has a mention of this at around 7:40 (timestamp). It is strange that they have not put this down as text.

like image 137
AndroidMechanic - Viral Patel Avatar answered Nov 15 '22 05:11

AndroidMechanic - Viral Patel


I also face the same issue with Android Studio

Please uncomment the line

org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

and increase the org.gradle.jvmargs=-Xmx1024m to org.gradle.jvmargs=-Xmx2048m

in gradle properties file

also include

defaultConfig {
    multiDexEnabled true
}

in your module level build file.

it worked for me, hope it worked for you too..!

like image 27
AkhileshSoni Avatar answered Nov 15 '22 05:11

AkhileshSoni