0

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?

Tim Kochetkov
  • 149
  • 1
  • 11
  • Have just noticed that here GRADLE_USER_HOME=$USER_HOME/.gradle I might not be using the correct slash. Changed, will try again and see if it impacts anything. – Tim Kochetkov Aug 25 '22 at 08:38
  • Restarted my PC after the change, the initial build took 28.4 s. I do not know if it is good enough for me. I have a Ryzen 1700x (8 cores, 16 logical processors) a Samsung SSD and a good set of DDR4 RAM, which always does the job in any task. For the empty project like this I doubt there should be any hiccups for my system. And I do not even know if this last build time is affected by caching or not. – Tim Kochetkov Aug 25 '22 at 08:46
  • https://stackoverflow.com/questions/55716882/which-file-gradle-properties-is-higher-priority Probably because the gradle.properties in my project files was being read first. Deleted it and added 2 lines regarding AndroidX and Jetifier to the file in .gradle . – Tim Kochetkov Aug 25 '22 at 12:38

0 Answers0