I've updated Android Studio to 1.0 RC (both 1 and 2) from 0.9x and my project build time passed from 20 sec to around 90 sec.
Anyone is having the same problem?
UPDATE
Running the same task on terminal, I see that the "Resolving dependencies" step is taking most of the extra time.
UPDATE 2
Thanks to @bond, I've noticed that going offline lowers the build time to about 30 sec, so I tried to use mavenLocal() on the build.gradle, but no luck there either.
Top Level build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
}
}
There may be many plugins in Android Studio that you are not using it. Disabling it will free up some space and reduce complex processes. To do so, Open Preferences >> Plugins and Disable the plugins you are not using.
Android Studio needs at least 8 GB RAM to run better. Change your Hard Disk to SSD. Loading/Compiling/Designing/Writing time will be reduced even in 4GB RAM. Use Power Save mode from File Menu that will reduce lots of background work.
This happens due to the fact that the module needs to be built from the scratch every time. Enable gradle Offline Work from Preferences-> Build, Execution, Deployment-> Build Tools-> Gradle. This will not allow the gradle to access the network during build and force it to resolve the dependencies from the cache itself.
In compiler settings (Android Studio -> Preferences -> Project settings[your project] -> Compiler (Gradle-based Android Projects)), type --offline in the "Command-line options" box.
from ~4 minutes to ~20 seconds.
I ended up building the first time online, and after that switching to offline mode
That lowered the time to ~14 secs.
My guess is that gradle is trying to resolve dependencies online ignoring my "mavenLocal()" (and all its variants)
For Newcomers, who can't find Gradle Offline settings (Android studio 1.5.1)
File -> Settings -> Build,execution, deployment -> Build tools -> Gradle
last checkbox (Offline work)
and thanks a lot guys - from like 10 mins to 30sec
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With