Reputation: 6136
I'm using a mac with 16gb memory, ssd hdd and still Gradle sync takes 15mins+ every time I build, clean or open the project, are there any Android Studio optimisations possible to reduce this time.
-----update----
All of these helped to some extent
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx5120M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError . //increase Xmx and -XX:MaxPermSize accordingly
example:
buildscript {
repositories {
google() //1st priority in search
repo2()
repo3()
repo4()
mavenCentral()
jcenter() //least priority, when not found in all above repos
}
Upvotes: 15
Views: 13744
Reputation: 39836
You're probably using a +
symbol on the libraries you added to your project (and have a very slow internet connection). For example: compile 'com.android.support:support-v4:+'
This will make on every sync() gradle will check online if there's a new version. If you change to specific version number, for example: compile 'com.android.support:support-v4:22.2.0'
Then gradle will use the cached version that already been downloaded to your development machine.
Upvotes: 7
Reputation: 1394
I would try to change the gradle version of your project to 2.4. If I recall correctly, studio uses 2.2 by default. I tried and I got slightly better build times on a small project. Maybe you can get better improvements.
Here you can find how: Using gradle 2.4 in Android Studio
Upvotes: 1