I have a Google pixel xl that I have rooted. On my G3 I was able to use Hosts Editor (https://play.google.com/store/apps/details?id=com.nilhcem.hostseditor) without any issues. When I tried on my xl I can see and accept the SU request but the hosts file does not get modified.

I then tried manually editing it with a text editor and I've confirmed that it's modified but using Chrome I still get navigated to the old original website.

I have a test server in my home network and I'd like to be able to use my phone to hit the test site instead of the live one.

Is there something special in Nougat that is making this not work?

  • What happens when you ping the custom address you added to /etc/hosts from an adb shell? Does it resolve to your custom address or to the public one? – blendenzo Jan 7 '17 at 19:46
  • I did a ping using terminal Emulator for Android and it resolves to the public address so I guess it's not doing the lookup in the hosts file. – John the Ripper Jan 7 '17 at 19:57
  • I've managed to figure this out and it was due to some strange encoding issues with the text editor I was using (droidedit). I should have known that a 2KB file with only a few lines was not correct. Once I used a different editor the file became 82 bytes and everything works as expected. – John the Ripper Jan 7 '17 at 20:16
  • Could you by any chance try this method: reddit.com/r/Nexus5/comments/3nzg6q/… to try and modify the hosts file without root? Apparently it works on Marshmallow, but people have had no luck getting it to work on Nougat. See reddit.com/r/Nexus6P/comments/4zof9c/… I'm wondering if your encoding discovery might solve the problem. – user204214 Jan 7 '17 at 21:03
  • I'm already rooted though. – John the Ripper Jan 7 '17 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.