1

My Android project gets built fine on a Windows dev machine with lots of RAM. But in a simple Docker container (FROM ubuntu:xenial + Android SDK) gradle build (./gradlew assembleTrunkDebug) fails on 58% while executing the task:

transformClassesWithPreJackPackagedLibrariesForTrunkDebug

Even with --stacktrace --debug the most I get from the error is:

Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

There are several strange thing that I have noticed: It doesn't matter what memory arguments I'm passing to the docker container instantiation. It always shows me the same memory stats.

Tasks:   2 total,   1 running,   1 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1019776 total,   860604 free,    88840 used,    70332 buff/cache
KiB Swap:  1168688 total,   853640 free,   315048 used.   824484 avail Mem

I'm usually doing something like:

docker run -it --volume=/Users/MyUser/code/localDebugRepo:/localDebugRepo --workdir="/localDebugRepo" --memory="2048m" --memory-swap="2048m" 66b48030ee34 /bin/bash

But I have also tried to pass less memory and the same memory-swap or more total memory, but it always shows me Mem: 1019776 and Swap: 1168688.

I also noticed in the task manager that VBoxHeadless.exe uses only 41MB of RAM. While the misfortunate task is running (which takes a long time before crashing), the RAM usage doesn't change, but the Disk transfer is huge and only consumes more and more (since it's on SSD drive).

Android suggests the new build tool Jack and Jill used for the latest sdks has to be allowed to use at least 1536m memory. But the Docker image should run with max of 2048m and having in mind that I wasn't able to shrink the swap, I have the feeling something goes wrong there.

So any thoughts what might have caused this consistent error?

Galya
  • 6,294
  • 6
  • 27
  • 45

0 Answers0