Sometimes, Jack just doesn’t want to play. Here is the error I got while trying to compile AOSP 7.0 for the Samsung SGH-M919, T-Mobile S4:

[CODE]
[ 1% 73/5641] Ensure Jack server is installed and started
Jack server already installed in “/home/alaskalinuxuser/.jack-server”
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/alaskalinuxuser/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
[ 1% 74/5641] Building with Jack: out…k_intermediates/with-local/classes.dex
FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp
Communication error with Jack server (52). Try ‘jack-diagnose’
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
[/CODE]

And here is how I solved it:

[CODE]
$ export JACK_SERVER_VM_ARGUMENTS=”-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g”
$ ./prebuilts/sdk/tools/jack-admin kill-server
$ ./prebuilts/sdk/tools/jack-admin start-server
[/CODE]

Essentially, Jack has an issue with regards to memory. What I have done here is give it more heap size to buffer the work that it is doing. I’ve done this by passing an argument to Jack through an environment variable. This variable will go away as soon as I close the terminal I am working in. I then stop and restart the Jack server.

This trick also works well if Jack tells you that you don’t have enough memory to compile something. You may get an error like this:

[CODE]
FAILED: ….
Try increasing heap size with ‘-Xmx<size>’
[/CODE]

You can set the heap size to anything you want, but 4 GB worked pretty well for me.

Linux – keep it simple.

5 Replies to “Compiling: Problems with Jack”

  1. Error seen:
    bash: export: `-XX:+TieredCompilation’: not a valid identifier
    bash: export: `-Xmx4g”’: not a valid identifier

Leave a Reply to AlaskaLinuxUser Cancel reply

Your email address will not be published. Required fields are marked *