Although the Sony Xperia Z5 was released on October 2015, it is still one of the best flagship devices out there thanks to it’s build quality and specs. Rocking a Snapdragon 810 along with 3GB of RAM, the Xperia Z5 would be perfect for installing and experiencing the latest Custom ROMs. With the unfortunate demise of CyanogenMod, LineageOS has carried over the torch and builds based on Android 7.1.1 Nougat for the Xperia Z5 are being pushed out.
- A Windows PC
- ADB & Fastboot
- USB Cable (double check for faults)
- At least 60% battery remaining on your device
Unlocking the Bootloader
Note: This will wipe all data on your device. Make sure you backup important files as necessary before proceeding.
- Visit Sony’s Unlocking website and choose your device from the drop list. Click continue and enter your email. You should receive an email with a link and be prompted to enter your IMEI number.
- To get your IMEI number, dial *#06# on your phone’s dialer. Enter this IMEI number on the website as prompted and follow the instructions. You should get your unlock code, save this code safely.
- Enable Developer Options on your device. This can be enabled by going to Settings, About Phone and tapping the Build number about 5 times. This should enable the Developer Options on the Settings menu. In Developer Options, turn on Enable OEM Unlock and USB Debugging.
- Open up ADB & Fastboot on your PC and connect your device. Enter “adb devices” to confirm the connection. You should see your device listed. It is advised to disconnect all other Android devices, if any. Enter “adb reboot bootloader”, this will reboot the device to bootloader mode.
- Enter “fastboot devices” to confirm the connection. Now, enter “fastboot -i 0x0fce oem unlock 0x[unlock key from sony]”.
- Your device should be now unlocked.
If you’re not in fastboot mode, follow the above steps and enter fastboot mode. We need to download the TWRP files for our respective devices from the links below:
- TWRP for Sony Xperia Z5: Download
Download the TWRP file, rename it to “twrp.img” (no quotes) and place in the folder where you have setup your ADB & Fastboot.
Once the file is in the folder, we can go back to ADB and type in the command:
fastboot flash recovery twrp.img
This will replace the stock recovery with TWRP. Once the flash completes successfully, reboot the device into recovery to verify the installation. To reboot to recovery, simply enter “fastboot reboot recovery” in adb when in the fastboot menu.
Download the LineageOS zip package and copy it to your device’s internal storage. Boot to recovery by using the adb method above. In the TWRP menu, select Wipe, then Factory Reset. Then, select Install and choose the LineageOS zip package. This will prompt you to “Swipe to Flash”. Once the installation has finished you can Reboot to System. Note that the first boot might take a while.
Optional: You can also choose to flash GApps to obtain Google Services after flashing LineageOS. You can follow the tutorial to flash GApps.