AdAway appAdAway is System tool that is open source under the GPL-3.0-only license. A Free and Open Source ad blocker for Android.
The application is available for rooted and non-rooted devices.
Using rooted device, the application update your system hosts file that contains a list of mappings between host names and IP addresses.
Using non-rooted device, the application use the VPN feature to block outgoing connections to ads and trackers.
So when an app requests an ad or a tracker from a host in that file, this request is redirected to the local IP 127.0.0.1, which does nothing.
You can download predefined ads and blocker lists as hosts files from within the app to incorporate. It is also possible to use your own files and to add certain hosts to allowed and blocked lists.
There are options to run a local web server to respond to blocked host names and to direct requests to the IP address of your choosing instead.