My Android Studio project used to build faster but now it takes a long time to build. Any ideas what could be causing the delays? I have tried https://stackoverflow.com/a/27171878/391401 but no effect. I dont have any Anti virus running which could interrupt the builds. My app is not that big in size as well (around 5MB) and it used to build within few seconds but not sure what has changed.
10:03:51 Gradle build finished in 4 min 0 sec
10:04:03 Session 'app': running
10:10:11 Gradle build finished in 3 min 29 sec
10:10:12 Session 'app': running
10:20:24 Gradle build finished in 3 min 42 sec
10:28:18 Gradle build finished in 3 min 40 sec
10:28:19 Session 'app': running
10:31:14 Gradle build finished in 2 min 56 sec
10:31:14 Session 'app': running
10:38:37 Gradle build finished in 3 min 30 sec
10:42:17 Gradle build finished in 3 min 40 sec
10:45:18 Gradle build finished in 3 min 1 sec
10:48:49 Gradle build finished in 3 min 30 sec
10:53:05 Gradle build finished in 3 min 22 sec
10:57:10 Gradle build finished in 3 min 19 sec
10:57:11 Session 'app': running
In Android Studio go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
(if on mac) Android Studio -> preferences... -> Build, Execution, Deployment -> Build Tools -> Gradle
Check the 'Offline work' under 'Global Gradle settings'
It will reduce 90% gradle build time.
if you just added a new dependency in your gradle you will have to uncheck the offline work or gradle will not be able to resolve the dependencies. After the complete resolving then you you can check the offline work for a faster build
1) My build time severely increased after i added some new library dependencies to my gradle file, what turned out that i need to use multidex after that. And when i set up multidex correctly then my build times went up to 2-3 minutes. So if you want faster build times, avoid using multidex, and as far as possible, reduce the number of library dependencies.
2) Also you can try enabling "offline work" in android studio, like suggested here, that makes sense. This will not refetch libraries every time you make a build. Perhaps slow connection or proxy/vpn usage with "offline work" disabled may lead to slow build times.
3) google services - as mentioned here, dont use the whole bundle, use only the needed parts of it.
I had the same issue in kotlin. Updating the outdated kotlin runtime solved it for me
@AndroidDev solution worked for me. I had included the whole lib in gradle.
Changing to solved the problem. From 4 min to 1 min.
Thnx
Try restarting your computer and running Android Studio again. Worked for me when trying to build a Cordova / Phonegap project with an Android target codebase.
Enabling Java 8 features caused deadly slow build
gradle
After deleting above lines, it builds in seconds.
There is issue Compiling with Jack takes very long time
Project Manager's Answer
As of now, latest Gradle version i can find is 2.3.0-beta4