back to the beginning
Last updated: 2019-01-23 (Migrating instructions from 15.1 -> 16 (things may break))
This page is for building LineageOS 16 (I recommend staying on 15.1 for now.)
On 2019-01-16 the code still had issues: see log
LineageOS 15.1 build instructions.
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 want to use Google apps, then use get LineageOS from here. You can still use these instructions to install.
WARNING: Moving from stock Android to LineageOS (including builds from
various sources that use different build keys!) 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).
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 ~
# add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
Run the following command to update your shell:
sudo apt install -y bc build-essential ccache curl 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 m4 openjdk-8-jdk pngcrush repo rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
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-16.0
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.
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-16.0-20190116-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: