This post will go through how you can block ads (and tracking) on your Android device(s) with solutions for both rooted and unrooted devices.
2018-11-24: updated Blokada screenshot and settings instructions
- block ads, analytics/tracking, cryptomining, and malware
- reduce data usage (and battery usage) by reducing the number of requests being sent to blocked domains
- protect your privacy by blocking analytics/tracking
- works system-wide, not just for your browser
- may break some apps/functionality (but can be mitigated by disabling blacklist sources or whitelisting apps (in Blokada))
- if your device is unrooted:
- possible conflict with any existing VPN app (cannot use both at the same time)
- slightly more battery usage than if your device was rooted + AdAway
Open F-Droid on your Android device and download and install it. You may be prompted that it’s an installation from an unknown source; if you see this, you will have to allow permission to F-Droid via the prompt.
F-Droid can be considered to be a version of the Google Play Store containing free and (mostly) open-source apps. It will also help keep any install apps updated by prompting you when there is an update available.
Install the Adblocker
If your device is rooted, I recommend AdAway. Search for it in F-Droid, install it, open it, and enable it (it will ask you to grant it root access). AdAway uses virtually no battery resources as it does not need to run in the background. (more info on AdAway can be found on its website I linked)
If your device is not rooted, I recommend Blokada. Again, search for it in F-Droid, install it, open it, and enable it. Blokada works by transparently running a VPN server locally on your device, routing all traffic through it and blocking any traffic being sent to blacklisted domains. The impact on battery is minimal. A nice thing about Blokada is it keeps track of how many domains it has blocked and what the last blocked domain was. I only installed it a day ago and right now I’m at 2,598 domains blocked. (Blokada help page)
Due to how Blokada works, if you use a VPN app they are currently incompatible with Blokada but the developer is looking into addressing this soon.
Configuring the Adblocker
AdAway: the default settings are sufficient. I’ve added my personal blocklist (see below).
Blokada: see below for my recommend settings (click to enlarge) –
- DNS (left, 3rd row): set to Cloudflare, but you can choose any. Since we’re using blacklists, I don’t see any point in using the DNS servers which come with filtering (e.g. AdGuard)
- Blacklist (left, 2nd row): I have disabled all built-in blacklists and added/enabled my personal blacklist (see below)
- Whitelist (right, 2nd row): I left the defaults as is. If you run into any issues with an app, you can add it to the whitelist or disable blacklists (process of elimination) to try to fix any issues
- Advanced Settings (right, 4th row):
- Lists download frequency: once a day
- Download on WiFi only: enabled
- Start on boot: enabled
- Keep alive: enabled
- Watchdog: disabled
My Personal Blocklist
For both AdAway and Blokada, I also added my personal blocklist which blocks: ads, malware, tracking, cryptomining, Windows spying/tracking, and fake news. They are automatically updated daily. There are two versions because of just how comprehensive it is (copy and paste the URLs and paste into the adblocker as a new blacklist source):
- HOSTS Complete – 108,265 domains, 3.16 MB: https://gitlab.com/andryou/andrews-settings/raw/master/hosts
- includes: Malware Domain List, someonewhocares, MVPS, yoyo.org, Badd Boyz, CoinBlocker, lightswitch05, UncheckyAds, KADhosts, AdAway, FadeMind’s extras, fakenews, andrew, nocoin, winspy, hphosts, adguard, easylist, easyprivacy
- HOSTS Lite – 45,814 domains, 1.24 MB: https://gitlab.com/andryou/andrews-settings/raw/master/hostslite
- includes: Malware Domain List, someonewhocares, MVPS, yoyo.org, Badd Boyz, CoinBlocker, lightswitch05, UncheckyAds, KADhosts, AdAway, FadeMind’s extras, fakenews, andrew, nocoin, winspy
Feel free to try the complete version first, and if you run into any memory usage issues use the lite version.
A good point to make is that my blocklists work on any device which supports HOSTS blocking! I use the lite version on my home router (search for adblock on that page) as it can’t quite handle the complete version.
NOTE: the above two links contain my personal blocklist which blocks SwiftKey from communicating to its servers and it also blocks Piriform/CCleaner domains (re: CCleaner v5.45 showing they have gone downhill). I do not trust a keyboard which sends data back to a server which is why I am blocking SwiftKey from doing so, but on the other hand SwiftKey’s prediction heuristics are one of the best out there so it’s my keyboard app of choice.
If you do have a rooted device, I recommend installing AFWall+ through F-Droid which will allow you to allow/block apps from accessing the Internet.