UPDATE 2018-01: This is somewhat outdated as microG has released their own fork of LineageOS. See details below.
microG has released their own fork of LineageOS which can be accessed here! This makes microG easier to handle as now you don’t have to apply signature spoofing to your ROM each time you reboot your device. This fork of LineageOS can be installed same way upstream LineageOS is. Now you have microG and F-Droid preinstalled and ready to go!
Many people try to avoid Google products and services for different reasons. Even people who like Android, use iOS or something else instead because of this. But you can actually run Android without Google’s proprietary software. Okay, how do we do this? We are going to install these on your device:
- TeamWin Recovery
- Yalp Store
We are going to need these on your computer:
- ADB and fastboot
- Java Runtime Environment
If you do not need proprietary apps (like Whatsapp or Instagram) on your phone, Yalp Store and microG are not needed.
Pretty much every Android device has Google apps installed by factory default, and removing them from the stock ROM is quite troublesome, even though possible. To make things easy (and most likely more free) we are going to install LineageOS your device. LineageOS is based on Cyanogenmod which you have probably heard of and does not include Google apps for legal reason, but that’s what we want. Fetch a ROM zip file for your device from the LineageOS download site. Also download the su addon zip file if needed, as LineageOS doesn’t provide root access without it.
Flashing the LineageOS ROM requires a recovery software. For this purpose we are getting the TeamWin Recovery. Find the .img file for your device from their website.
Caution! Flashing images on your device will overwrite data and in wrong hands can brick your device. Steps in this guide work on my Nexus 5X and should work identically in other Nexus devices too, but some things might be different on your non-Nexus device (for example Odin and Heimdall for Samsung devices). Backing up your data is strongly recommended before continuing.
Enable Developer options and unlock bootloader
On vanilla noncustomized Android, like on Nexus devices, you can enable Developer options by tapping the Build number row in About phone section in your Settings app until you get a message on screen saying that you have enabled your developer options.
Under the Developer options you should be able to toggle OEM unlocking on to allow the bootloader to be unlocked. In the Developer options also enable ADB by turning Android debugging on. After you have done that, let’s try connecting your device:
$ adb devices
This should print:
List of devices attached 01105e0bf43020b8 device
If similar output was printed, we know we have adb connection. Let’s reboot to bootloader:
$ adb reboot bootloader
When the device has booted to bootloader, we can open the locking the bootloader (this will wipe all your user data on the device):
$ fastboot oem unlock
Your device should ask if you are sure you want to unlock the bootloader. Once this is done:
$ fastboot reboot
Flash the recovery
Let’s get back to the bootloader:
$ adb reboot bootloader
In the bootloader we will flash the previously downloaded .img file for TWRP recovery
$ fastboot flash recovery twrp.img
Flash the LineageOS
Reboot to your new recovery mode:
$ fastboot reboot recovery
To flash the LinegeOS, we need to copy it over to your device somewhere convenient:
$ adb push lineage-signed.zip /sdcard/
If you downloaded the su .zip file, copy it using the same command.
TWRP has really nice touch interface, which you can easily use to install your actual OS rom to your device. It’s generally recommended to wipe data on the device before flashing the rom.
After wiping, pressing the Install button opens a file browser, where you have to select the .zip file for LineageOS. It should be in the directory that opens up first, if you copied it to /sdcard/. After the LineageOS .zip you can select the su .zip file to make it flash after LineageOS. After flashing TWRP gives you an option to reboot to your freshly flashed system.
If everything went right, you are now using LineageOS! Now you can setup your device again, as all the old data and apps are gone.
How do you live without the Play Store?
For this purpose we have F-Droid, where you can find all the most important free and open source apps for Android. Most of the basic needs are already filled by LineageOS like a web browser and an email app. Download F-Droid from the F-Droid website and install the app on your device. This requires that you have enabled Unknown sources in the security settings.
F-Droid only includes free and open source apps. If this is all you need, you have a ready to use your device!
But if you need Whatsapp or Instagram or any other non-free proprietary apps, you can install the Yalp Store from F-Droid. Think of Yalp Store as unofficial Google Play Store which you can use to get all your (possibly proprietary) apps you cannot find on F-Droid.
Tingle and microG
As you install proprietary apps in Yalp Store you will notice that many apps depend on Google Play Services package. microG provides the Google Play Services API for these apps without installing the actual Google Play Services package. microG does use Google servers to work even if microG itself is free software. To trick apps to use microG instead of the real Google package, we have to apply some signature spoofing using Tingle.
Download Tingle using the Github .zip archive or clone the git repository. From the Developer options on your device give root access to adb, connect your device to USB again and run Tingle:
$ python3 main.py
And select the first option so Tingle will handle your device through adb. When Tingle has run successfully, reboot your device. As your hands are still on the keyboard, you can reboot using this command
$ adb reboot
If your device doesn’t boot after running Tingle (it should boot longer than usual though), your device might not be supported by Tingle. Fortunately the changes Tingle made can be reverted easily using the command Tingle printed once you boot to recovery mode.
After this you can install microG from F-Droid. You should install these apps:
- microG Services Core
- microG Services Framework Proxy (if you need Google Cloud Messaging for push notifications)
- microG DroidGuard Helper (if you need Google SafetyNet)
- Your favourite NlpBackend, I recommend MozillaNlpBackend (if you need location service)
Now you shoud have microG settings in your app drawer. There you can apply the settings you need. After that you should reboot your device.
Now you device is ready to use! If you installed Yalp Store and microG, your device is still connecting to the Google servers, but the connection is at least in your control. Also your battery life should improve!
If you skipped installing Yalp Store and microG, your Android experience is now completely degoogled. Yay!