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
- replace all compile 'com.package.:+' with appropriate versions, check maven repos for the latest build, better practise to develop on a version than dynamic updates, it may introduce bugs or issues.
- close project and restart mac/windows.
- Update Android studio if there is one
- updating gradle version
- turn on gradle daemon, parallel daemons and increase heap size in gradle.properties
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx5120M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError . //increase Xmx and -XX:MaxPermSize accordingly
- Reorder your repositories and put google's repos first. Bintray, jcenter, maven repos may have missing or corrupt google play/ google services dependencies resulting in fetch delays
example:
buildscript {
repositories {
google() //1st priority in search
repo2()
repo3()
repo4()
mavenCentral()
jcenter() //least priority, when not found in all above repos
}