hosts Enabler

hosts Enabler allows to use /system/etc/hosts file on configurations/ROMs (mostly symlinked hosts file on Android 4.4+) where it is ignored.
Hosts file usually gets ignored on some ROMs due to SELinux restrictions if it is a symlink to file on different partition.

Technically it works by attaching to all packages/apps and hooking DNS resolution API. On first name resolution API call hosts file is read and stored in memory (in HPPC OpenHashMap structure).

Additional features of hosts file introduced by hosts Enabler:

  • use of IP address allows to fail name resolution of associated hosts
  • use of DNS names instead of IP addresses (these DNS names are passed directly to DNS resolver - they are not looked up in hosts file recursively)

Known limitations:

  • JNI libraries are not affected (some applications may still ignore hosts file)
  • hosts file is read in memory of each application when it makes first DNS query (time and memory used depends on size of hosts file; time is logged in logcat with tag "hostsEnabler")

Disclaimer: Author of hosts Enabler is not responsible for anything that may happen as a result of using this mod.

hosts Enabler uses HPPC: High Performance Primitive Collections for Java library which is distributed under Apache License 2.0.

XDA Thread:

Version name: 
Release type: 
Stable (low risk of bugs)
Number of downloads: 
39,543 in total · 2 in the last 24 hours
MD5 checksum: 
Uploaded on: 
Sunday, August 31, 2014 - 00:32
  • Initial release.