Hello! I've tried to run the build of an android a...
# gradle
m
Hello! I've tried to run the build of an android app inside the docker container without gradle daemon.
./gradlew assembleDebug --no-daemon
and I've got a message
To honour the JVM setting for this build single-use daemon will be forked
So I read I have to set the ENV variable JAVA_OPTS and GRADLE_OPTS to the same content as org.gradle.jvmargs. But it's still forking Gradle Daemon. What else should I do to compile a project without a daemon?
a
You could try digging through the logs to see why the deamon is launched https://github.com/gradle/gradle/issues/11517#issuecomment-602632296
v
The short answer is, don't
Before I write the long answer I'd like to ask why you would want to
m
I just want to speed up the CI build. It takes nearly one minute to spawn Gradle daemon and Gradle docs says I can disable it if JVM agrs mach what build requires.
v
You can, but it really is PITA. You should probably rather check why the hell it needs a minute to spawn a Gradle daemon. That is not normal.
There are some JVM args that Gradle deems unmodifiable and thus if the CLI VM does not match causes an agent to be started. Mostly, these are the heap settings. But one important thing since some versions is the instrumentation agent from the Gradle distribution. So you also have to makes sure that this is included in the
GRADLE_OPTS
.
If you run your build with
--debug
you find a line "[DEBUG] [org.gradle.launcher.daemon.client.DefaultDaemonStarter] Using daemon args:" that shows exactly which args were used to start the daemon. You can try from there what you need, but most probably the
-Xm...
options and the instrumentation agent.
But it really shouldn't need that long to start a daemon process