This is for people that like to use the stock firmware (I'm one of them) and you are rooted with ElementalX. One of my main reasons to root the phone is to use AdAway (or similar) to get rid of annoying and useless ads.
Well, the hosts file is write protected by the stock Android and cannot be overwrite by AdAway, even if you give root access. AdAway suggests a work-around for this and this is how you apply it.
1. First run AdAway - it will fail writing the system hosts file, but the new hosts file is downloaded on the phone.
Now change to fastboot mode and then boot TWRP (there is no need for TWRP to be flashed with stock).
I usually do it from a command window opened in the TWRP folder (Shift-RightClick), like this:
Now you are in fastbootmode.
Of course, replace the TWRP name with "twrp-3.0.2-r4-athene.img" if that's is what you have.
In TWRP screen now:
1. Select MOUNT and check the System partition. Go back.
2. Select ADVANCED>TERMINAL
You have a # prompt. If not, type SU.
3. Type the following two lines in that terminal:
This renames the existing hosts file to hosts.bak . Not really needed... but better safer than sorry.
This creates a symbolic link to a location that AdAway can write.
Reboot and enjoy.
Well, the hosts file is write protected by the stock Android and cannot be overwrite by AdAway, even if you give root access. AdAway suggests a work-around for this and this is how you apply it.
1. First run AdAway - it will fail writing the system hosts file, but the new hosts file is downloaded on the phone.
Now change to fastboot mode and then boot TWRP (there is no need for TWRP to be flashed with stock).
I usually do it from a command window opened in the TWRP folder (Shift-RightClick), like this:
Code:
adb reboot-bootloader
Code:
fastboot boot twrp-3.1.0-athene_shreps.img
In TWRP screen now:
1. Select MOUNT and check the System partition. Go back.
2. Select ADVANCED>TERMINAL
You have a # prompt. If not, type SU.
3. Type the following two lines in that terminal:
Code:
mv /system/etc/hosts /system/etc/hosts.bak
Code:
[COLOR="Blue"]ln -s /data/hosts /system/etc/hosts[/COLOR]
Reboot and enjoy.
Last edited: