Well, Jack doesn’t actually turn into a Ninja. Actually Jack gets beat up by one. On my computer at least.
I’ve used Jack for a while now, when compiling Marshmallow roms. However, Jack keeps having problems while I am building Nougat roms. In fact, Jack seems to sit down and cry every time “Ninja” shows up. I keep getting a “out of memory” error for the Jack server.
Being somewhat used to Jack, I tried setting arguments by exporting them into the environment variables, as I mentioned in a previous post, but that wasn’t helping. So, I went to https://source.android.com/source/jack.html and read up about Jack. Unfortunately, none of the things that they recommend there are working.
Then I really read that link. Near the top of the page, it says:
“For instructions on using Jack in Android 7.0 (N) and later, see the Jack server documentation. For Android 6.0 (M), use the instructions in this section.”
Ahh, now I see the error of my ways. After going to the new Jack documentation ( https://android.googlesource.com/platform/prebuilts/sdk/+/master/tools/README-jack-server.md ) I found this lovely tidbit:
“If you experience Jack compilations failing on Out of memory error.:
You can improve the situation by reducing the number of jack simultaneous compilations by editing your $HOME/.jack-server/config.properties and changing jack.server.max-service to a lower value and then restarting the server.
If this is not enough, you may change the arguments used to start the server jvm and force a greater maximum Java heap size (“-Xmx”):
Stop the server using jack-admin stop-server, then:
If you start the server manually:
JACK_SERVER_VM_ARGUMENTS=”-Xmx2g -Dfile.encoding=UTF-8 -XX:+TieredCompilation” jack-admin start-server
If you use the jack server in the android tree then
export ANDROID_JACK_VM_ARGS=”-Xmx2g -Dfile.encoding=UTF-8 -XX:+TieredCompilation”
and restart your build command.”
So, now I can get Jack to join the Ninja party.
Linux – keep it simple.