The following are a couple of recommendations for setting up a Host machine for building the Android Nougat 7.1.1_1.0.0 BSP. Some of these recommendations are not exclusive of the Nougat release and may help in other scenarios. These also apply to using Virtual Machines as Host.
Installing Open JDK 8 on Ubuntu 14.04
As mentioned on the Android guide for Establishing a Build Environment (http://source.android.com/source/initializing.html) there are no available supported OpenJDK 8 packages for Ubuntu 14.04, which is the version recommended and tested on the Nougat Android BSP. An alternative is downloading the Ubuntu 15.04 Open JDK 8 packages and installing them manually, which can be done by following this procedure:
Download the .deb packages for 64-bit architecture from archive.ubuntu.com:
openjdk-8-jre-headless_8u45-b14-1_amd64.deb with SHA256 0f5aba8db39088283b51e00054813063173a4d8809f70033976f83e214ab56c0
openjdk-8-jre_8u45-b14-1_amd64.deb with SHA256 9ef76c4562d39432b69baf6c18f199707c5c56a5b4566847df908b7d74e15849
http://archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre_8u45-b14-1_amd64.deb
openjdk-8-jdk_8u45-b14-1_amd64.deb with SHA256 6e47215cf6205aa829e6a0a64985075bd29d1f428a4006a80c9db371c2fc3c4c
http://archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jdk_8u45-b14-1_amd64.deb
Once you have downloaded these three packages and checked the checksum for them install the packages (optional) install them by running:
$ sudo apt-get update
$ sudo dpkg -i openjdk-8-jre-headless_8u45-b14-1_amd64.deb
$ sudo dpkg -i openjdk-8-jre_8u45-b14-1_amd64.deb
$ sudo dpkg -i openjdk-8-jdk_8u45-b14-1_amd64.deb
Increasing SWAP to compensate for the lack of RAM
Having insufficient RAM especially on the linking part of the image build may cause a number of issues that are difficult to troubleshoot. In these cases it’s good to take a look at the resource monitor to see if indeed the RAM was depleted.
One way to make up for the limited RAM is using a bigger swap. Google recommends at least 16GB of RAM/swap so it’s not uncommon to create a 10GB swap when working in VM, to do this please use the following commands.
$ sudo fallocate -l 10g /mnt/10GB.swap
$ sudo chmod 600 /mnt/10GB.swap
$ sudo mkswap /mnt/10GB.swap
$ sudo swapon /mnt/10GB.swap
Increasing heap size to avoid out of memory errors
It is possible to encounter an out of memory error with the recommendation “try increasing heap size witj java option ‘-Xmx<size>’. If you encounter this error or would like to proactively avoid it you may run the following commands that will increase heap size to four gigabytes and then reset the Jack Server by killing it and starting it again.
With the android environment initialized:
$ cd my android
$ export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
$ jack-admin kill-server && jack-admin start-server
Fixing Jack Servers errors due to multiple users on the Host
Android Nougat uses Jack Server as mono-user by default. If this is not the case for your host you would need to choose different port numbers for each user and adjust SERVER_NB_COMPILE accordingly. You can also disable the Jack server by setting SERVER=false in your $HOME/.jack.
Alternatively, you may also use the patch available on the following link to myandroid/prebuilts/sdk. It will help to fix the mono-user build restriction. When installing the jack-server, it will detect if Jack server is running in the same build machine and then generate a random ports for my build instead of using the default one.
https://groups.google.com/forum/#!topic/android-building/UWhJrXH8Vig
jamesbone, diegoadrian, Bio_TICFSL, y los demás que no me deja taggear Jive, what would you think if we created a document as a troubleshooter or guide trough the errors we saw on the Nougat Sanity Check? Do you think it would help or would it make matters worse now that the BSP gets released?
Regards,
Gustavo
Hi gusarambula,
I tried your suggestion. but does not work on my side :smileysad: I think we will have to apply the Guoyin email response to diego.
/Alfredo
Sure! What was the workaround suggested to Diego? And more importantly, did it worked?
Very good document Gus, Unfortunately, it didn't work for me. Could be good adding a note mentioned that it is a possible working solution, but doesn't cover all the cases or something like that.
Hi NXP member
Do you have solution about Ubuntu 16.04 + openjdk8 or Ubuntu15.04 +openjdk8?
Form Google:
Establishing a Build Environment | Android Open Source Project
We just only need to send command " $ sudo apt-get update" + " $ sudo apt-get install openjdk-8-jdk" for BSP Host Setup.
Finally, after several days. Probably I found the solution to the jackserver problem.
Instead of configuring the heap memory size with gigabytes, I used megabytes:
$ cd myandroid
$ export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4069m"
$ jack-admin kill-server
$ jack-admin start-server