back to the beginning
Last updated: 2019-01-22
Instructions for LineageOS 16.
LineageOS is an alternate version of the Android operating system for your phone. Rather than building it yourself the first time, I recommend you use the image provided by invisblek. However, his image includes Google apps by default. If you want to experience life without Google's apps you will have to build LineageOS yourself. If you do choose to build it yourself, you can also install the Google apps at any time.
WARNING: Moving from stock Android to LineageOS (including builds from various sources!) or back again will require restoring your phone to factory settings. YOU WILL LOSE ALL YOUR DATA. YOU MUST COPY ANYTHING YOU VALUE OFF OF THE PHONE.
LineageOS features still not working (most notable for me):
If you want to remove LineageOS and return to stock Android follow the instructions here:
You will lose all your data so make a backup beforehand (see step for that below).
A quality USB cable. The manufacturer recommends you do not use the cable provided with your phone for anything other than charging.
invisiblek's installation notes These have been updated and contain a lot of useful information.
All instructions assume you are running Linux. These instructions are for Ubuntu with minimum version of 16.04.
You will need to install proper ADB (Android Debugging Bridge) tools for your platform. For Ubuntu 18.04 this is as simple as running
sudo apt install adb
If your distribution provides out of date tools you can obtain them directly from Google.
Install the tools from Google:
unzip platform-tools-latest-linux.zip -d ~
To add these tools to your path add the following to ~/.profile
# add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
Run the following command to update your shell:
Note that with Ubuntu 18.04 libesd0-dev is not available. Just delete the last item and install the rest of the tools.
sudo apt install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev 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 libesd0-dev
Also install a Java Development Kit
sudo apt install openjdk-8-jdk
If you get a version error with java, change the active one to version 8:
sudo update-alternatives --config java
mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Note: You can use a base directory somewhere else.
mkdir -p ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-15.1
Note: mata is the code name for the Essential PH-1. If you see other tutorials for building LineageOS you can follow their instructions but use mata where necessary. I suggest you look up another tutorial since I am leaving out instructions on using ccache. Apparently it can speed up your build but I did not want to commit even more disk space to the project. My desktop has 32 GB of ram and I felt the build was fast enough.
jack is required for building android 8.1 and LineageOS 15.1.
Run the following command from your shell and add it to ~/.bashrc so it is set up for future use.
export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
If you want to build root into your LineageOS image then also run the following and also add it to ~./bashrc
We will use the muppets repository to bring in all the extra bits required for the mata build rather than obtain them from the phone itself.
Add the following bit to the file located at ~/android/lineage/.repo/local_manifests/roomservice.xml
<project name="TheMuppets/proprietary_vendor_essential" path="vendor/essential" />
In the future consider all of the above are things you don't have to do next time. Anytime you want to build just start here. You only have to run repo sync when you want to make sure you have the lastest code. We need to run it now to pull stuff in from the Muppets.
repo sync [if on rebuilding you receive error try: repo sync --force-sync]
Once you manage an error free build you can quickly go to the directory where your LineageOS image is located by typing this:
In the folder there is is a file named lineage-15.1-20180601-UNOFFICIAL-mata.zip. The name will be based on the date you built LineageOS.
There is also a boot.img that you can use to install Magisk if you want to gain root that way at a later time.
back to the beginning
Something need fixing? Contact me: