Android Nougat : Failed Build /e/ without docker

Hi all,

I’m building Android Nougat.

Nom : Samsung Galaxy Note II
Device : t0lte
Android : Nougat
LineageOS : 14.1 (cm 14.1)
/e/ os : v0.20.2-nougat

To build Android Nougat, it need python 2.7 and openjdk-8 not openjdk-11.

Is it possible to fix this problem ? Thank you a lot.

build/core/config.mk:635: *** Error: could not find jdk tools.jar at /usr/lib/jvm/java-11-openjdk-amd64/bin/../lib/tools.jar, please check if your JDK was installed correctly. Arrêt.
  • Script builde.sh
#!/bin/bash
clear
while true; do
	read -p "When you flash the ROM be aware that lock screen and fingerprint can be removed easily, to prevent this encrypt your phone. Check community.e.foundation if your model supports encryption. I understand this message and want to coninue:(y/n)" yn
    case $yn in
          [Yy]* ) break;; 
	  [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done

# Install build dependencies
############################
#apt -qq update
#apt -qqy upgrade
#apt install -y imagemagick libwxgtk3.0-dev openjdk-8-jdk
#apt install -y openjdk-7-jdk
#apt install -y bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick libncurses5 lib32ncurses5-dev lib32readline-dev lib32z1-dev libtinfo5 liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev python python3 software-properties-common git

#install google repo
####################
mkdir ~/bin 2>/dev/null
PATH="$HOME/bin:$PATH"
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

# Environment variables
#######################

mkdir -p root

export WORKDIRR=/your_path

export TMP_DIR=$WORKDIRR/tmp

export SRC_DIR=$WORKDIRR/src
export CCACHE_DIR=$WORKDIRR/ccache
export ZIP_DIR=$WORKDIRR/zips
export LMANIFEST_DIR=$WORKDIRR/local_manifests
export DELTA_DIR=$WORKDIRR/delta
export KEYS_DIR=$WORKDIRR/keys
export LOGS_DIR=$WORKDIRR/logs
export USERSCRIPTS_DIR=$WORKDIRR/userscripts

export DEBIAN_FRONTEND=noninteractive
export USER=root

# Configurable environment variables
####################################
# By default we want to use CCACHE, you can disable this
# WARNING: disabling this may slow down a lot your builds!
export USE_CCACHE=1

# ccache maximum size. It should be a number followed by an optional suffix: k,
# M, G, T (decimal), Ki, Mi, Gi or Ti (binary). The default suffix is G. Use 0
# for no limit.
export CCACHE_SIZE=100G

# Clean artifacts output after each build
export CLEAN_AFTER_BUILD=true

# If you want to preserve old ZIPs set this to 'false'
export CLEAN_OUTDIR=false

# Include proprietary files, downloaded automatically from github.com/TheMuppets/
# Only some branches are supported
export INCLUDE_PROPRIETARY=false

# Environment for the LineageOS branches name
# See https://github.com/LineageOS/android_vendor_cm/branches for possible options
#
export BRANCH_NAME='v0.20.2-nougat'

# Environment for the device
# eg. DEVICE=hammerhead
export DEVICE_LIST='t0lte'

# Release type string
export RELEASE_TYPE='UNOFFICIAL'
#export LLVM_ENABLE_THREADS=1

# Repo use for build
export REPO='https://gitlab.e.foundation/e/os/releases.git'

# Repo use for build
export MIRROR=''

# OTA URL that will be used inside CMUpdater
# Use this in combination with LineageOTA to make sure your device can auto-update itself from this buildbot
export OTA_URL=''

# User identity
export USER_NAME=''
export USER_MAIL=''

# Change this cron rule to what fits best for you
# Use 'now' to start the build immediately
# For example, '0 10 * * *' means 'Every day at 10:00 UTC'
export CRONTAB_TIME='now'

# Provide a default JACK configuration in order to avoid out-of-memory issues
#export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx8G"

# Custom packages to be installed
#export CUSTOM_PACKAGES='PdfViewer GmsCore GsfProxy FakeStore com.google.android.maps.jar Mail BlissLauncher BlissIconPack MozillaNlpBackend OpenWeatherMapWeatherProvider AccountManager MagicEarth Camera eDrive Weather Notes Tasks NominatimNlpBackend DroidGuard OpenKeychain Message Browser BrowserWebView Apps LibreOfficeViewer'

export CUSTOM_PACKAGES='PdfViewer GmsCore GsfProxy com.google.android.maps.jar BlissLauncher BlissIconPack MozillaNlpBackend AccountManager OpenWeatherMapWeatherProvider Weather Camera NominatimNlpBackend DroidGuard OpenKeychain Message Browser BrowserWebView LibreOfficeViewer'

# Sign the builds with the keys in $KEYS_DIR
export SIGN_BUILDS=true

# When SIGN_BUILDS = true but no keys have been provided, generate a new set with this subject
export KEYS_SUBJECT='/C=FR/ST=French/L=Paris View/O=Android/OU=Android/CN=Android/emailAddress='

# Move the resulting zips to $ZIP_DIR/$codename instead of $ZIP_DIR/
export ZIP_SUBDIR=true

# Write the verbose logs to $LOGS_DIR/$codename instead of $LOGS_DIR/
export LOGS_SUBDIR=true

# Generate delta files
export BUILD_DELTA=false

# Backup the .img in addition to zips
export BACKUP_IMG=false

# Delete old zips in $ZIP_DIR, keep only the N latest one (0 to disable)
export DELETE_OLD_ZIPS=0

# Delete old deltas in $DELTA_DIR, keep only the N latest one (0 to disable)
export DELETE_OLD_DELTAS=0

# Delete old logs in $LOGS_DIR, keep only the N latest one (0 to disable)
export DELETE_OLD_LOGS=0

# Create a JSON file that indexes the build zips at the end of the build process
# (for the updates in OpenDelta). The file will be created in $ZIP_DIR with the
# specified name; leave empty to skip it.
# Requires ZIP_SUBDIR.
export OPENDELTA_BUILDS_JSON=''

# You can optionally specify a USERSCRIPTS_DIR volume containing these scripts:
#  * begin.sh, run at the very beginning
#  * before.sh, run after the syncing and patching, before starting the builds
#  * pre-build.sh, run before the build of every device
#  * post-build.sh, run after the build of every device
#  * end.sh, run at the very end
# Each script will be run in $SRC_DIR and must be owned and writeable only by
# root

# Create missing directories
############################
mkdir -p $TMP_DIR

mkdir -p $SRC_DIR
mkdir -p $CCACHE_DIR
mkdir -p $ZIP_DIR
mkdir -p $LMANIFEST_DIR
mkdir -p $DELTA_DIR
mkdir -p $KEYS_DIR
mkdir -p $LOGS_DIR
mkdir -p $USERSCRIPTS_DIR

# Copy build files to 
############################
rm -rf $TMP_DIR/buildscripts
git clone https://gitlab.e.foundation/e/os/docker-lineage-cicd.git $TMP_DIR/buildscripts

rm -rf $WORKDIRR/root/*
cp -rf $TMP_DIR/buildscripts/src/* $WORKDIRR/root/
cp -rf $TMP_DIR/buildscripts/build-community.sh $WORKDIRR/root/build.sh

# Install build dependencies
############################
cp $TMP_DIR/buildscripts/apt_preferences /etc/apt/preferences

# Download and build delta tools
################################
cd $WORKDIRR/root/ && \
        mkdir delta && \
        echo "cloning"
        git clone --depth=1 https://gitlab.e.foundation/e/os/android_packages_apps_OpenDelta.git OpenDelta && \
        gcc -o delta/zipadjust OpenDelta/jni/zipadjust.c OpenDelta/jni/zipadjust_run.c -lz && \
        cp OpenDelta/server/minsignapk.jar OpenDelta/server/opendelta.sh delta/ && \
        chmod +x delta/opendelta.sh && \
        rm -rf OpenDelta/ && \
        sed -i -e "s|^\s*HOME=.*|HOME=$WORKDIRR/root|; \
                   s|^\s*BIN_XDELTA=.*|BIN_XDELTA=xdelta3|; \
                   s|^\s*FILE_MATCH=.*|FILE_MATCH=lineage-\*.zip|; \
                   s|^\s*PATH_CURRENT=.*|PATH_CURRENT=$SRC_DIR/out/target/product/$DEVICE|; \
                   s|^\s*PATH_LAST=.*|PATH_LAST=$SRC_DIR/delta_last/$DEVICE|; \
                   s|^\s*KEY_X509=.*|KEY_X509=$KEYS_DIR/releasekey.x509.pem|; \
                   s|^\s*KEY_PK8=.*|KEY_PK8=$KEYS_DIR/releasekey.pk8|; \
                   s|publish|$DELTA_DIR|g" $WORKDIRR/root/delta/opendelta.sh

# Set the work directory
########################
cd $SRC_DIR

# Allow redirection of stdout to docker logs
############################################
ln -sf /proc/1/fd/1 /var/log/docker.log


#sed -i 's/\/root;/$WORKDIRR/root;/g' init.sh
sed -i 's#/root#$WORKDIRR/root#g' $WORKDIRR/root/init.sh
sed -i 's#/root#$WORKDIRR/root#g' $WORKDIRR/root/build.sh
# Set the entry point to init.sh
################################
$WORKDIRR/root/init.sh

#end script
  • Environment
sudo update-alternatives --config java
Il existe 2 choix pour l'alternative java (qui fournit /usr/bin/java).

  Sélection   Chemin                                              Priorité  État
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java          1111      mode automatique
* 1            /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java   1081      mode manuel
  2            /usr/lib/jvm/java-11-openjdk-amd64/bin/java          1111      mode manuel

All sources are download, but it fail while building is beginning.

  • Logs
>> [jeu. 06 janv. 2022 18:15:44 CET] Starting build for t0lte, v0.20.2-nougat branch
including vendor/cm/vendorsetup.sh
Looking for dependencies in device/samsung/t0lte
Looking for dependencies in device/samsung/smdk4412-common
Looking for dependencies in device/samsung/smdk4412-qcom-common
Dependencies file not found, bailing out.

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.1.2
LINEAGE_VERSION=0.20-n-20220106-UNOFFICIAL-t0lte
TARGET_PRODUCT=lineage_t0lte
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a9
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=NJH47F
OUT_DIR=/mnt/my_compile/android_7_nougat/e_os_galaxy_note_2_bis/src/NOUGAT/out
============================================
make : on entre dans le répertoire « /mnt/my_compile/android_7_nougat/e_os_galaxy_note_2_bis/src/NOUGAT »
build/core/config.mk:635: *** Error: could not find jdk tools.jar at /usr/lib/jvm/java-11-openjdk-amd64/bin/../lib/tools.jar, please check if your JDK was installed correctly. Arrêt.
make : on quitte le répertoire « /mnt/my_compile/android_7_nougat/e_os_galaxy_note_2_bis/src/NOUGAT »

#### make failed to build some targets  ####

>> [jeu. 06 janv. 2022 18:15:45 CET] Failed build for t0lte
>> [jeu. 06 janv. 2022 18:15:45 CET] Finishing build for t0lte
>> [jeu. 06 janv. 2022 18:15:45 CET] Cleaning source dir for device t0lte
make : on entre dans le répertoire « /mnt/my_compile/android_7_nougat/e_os_galaxy_note_2_bis/src/NOUGAT »
build/core/config.mk:635: *** Error: could not find jdk tools.jar at /usr/lib/jvm/java-11-openjdk-amd64/bin/../lib/tools.jar, please check if your JDK was installed correctly. Arrêt.
make : on quitte le répertoire « /mnt/my_compile/android_7_nougat/e_os_galaxy_note_2_bis/src/NOUGAT »`

Thank you a lot

Please can you tell us the distro and version you are using.

Sure, I’m using Debian Bullseye

The script is picking up java-11-openjdk rather than the jdk-8 that is needed. Try running sudo update-alternatives --config java again, press 1, to select j8. Then tye java --version to check that v-8 is activated

Post script Edit this answer is based on OP inclusion of “without Docker”. Docker is expected to organise containers for you. Keep sources up to date being aware of recent changes! e / os / docker-lineage-cicd · GitLab


I see that you have had help with this on Telegram! Did you already read the Java sub heading here? Build for t0lte | LineageOS Wiki.

I have also struggled with this in Debian as the Debian Java packagers seem to have been concerned (my view) over the years that Java versions will interfere with eachother.

I am assuming you have also been building more recent/advanced /e/ builds. I think you might need to try to get some sort of isolation within your build environment for Nougat. You are probably also aware, it is quicker the do a test build in Lineage rather than /e/ to pre test your environment. :slight_smile: