I have read tens of articles on SO and elsewhere, and the Gradle documentation several times. But could not find any relatable solution to my problem. Or, possibly, I am misinterpreting the actual valid behavior of Gradle.
I still get 2-3 minutes build time for a simple, almost empty sample android project on kotlin, without any heavy dependencies.
After closing and reopening the IDE after initial build without changing any of the files, the build times shrink to 20-25s, due to the build caching, but only for a limited period of time. I have just opened the project the first time this day and Gradle sync finished in 1m 21s .
The "Use Gradle from" setting in IDE is set to "'gradle-wrapper.properties' file".
These are the contents of the gradle.properties file located in C:\Users\Tim\.gradle :
#Enable daemon
org.gradle.daemon=true
# Try and findout the best heap size for your project build.
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# Modularise your project and enable parallel build
org.gradle.parallel=true
# Enable configure on demand.
org.gradle.configureondemand=true
I have tried changing these fields, commenting or removing them, as well as deleting gradle.properties file. It did not impact the performance whatsoever.
This is the list of environment variables on my system related to the Gradle that I retrieved using "set":
HOMEDRIVE=C:
HOMEPATH=\Users\Tim
USERNAME=Timofaey }D //this is the old name of the user, I use a symbolic link to the Tim user.
USERPROFILE=C:\Users\Tim
GRADLE_USER_HOME=$USER_HOME/.gradle
Path=C:\Gradle\gradle-7.5.1\bin;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
I have provided as much info as I could think of, let me know if you need something more specific.
Is there a way to know if Gradle is actually reading gradle.properties and using instructions from it?
Thank you.
Edit 26/08/2022 : the same project without any changes now builds in 3m 30s which is even worse than before. What is the cause?