Hot answers tagged

43

This is actually a compilation of answers and my own expirience. So, get/install a copy of ADB, then type adb devices -l # make sure your gadget is listed adb shell # run a shell there su # become the root (don't miss confirmation request!) mount -o rw,remount /system # allow to write vi /system/etc/hosts ## edit the file in place - do what you whant, then ...


16

Note : In-order to edit hosts file your device should be rooted You can edit etc/hosts file using ES File Explorer or any File explorers with root access. OR Check this method


8

Unless I missed something, that is not possible. Without root access only the mechanism of flashing an update (via recovery or OTA) can modify /system. To be accepted, such an update archive must be signed with the same key as the ROM – which is something only the developer of the ROM (here: the LOS team) can do. There might be a way via a custom recovery ...


2

It is possible to use a VPN profile* to affect hostname resolution. There are a number of apps now available on the Play Store that provide a convenient way to do this, such as Hosts Go. Note that, since this technique requires the use of a VPN profile, you won't be able to use an actual VPN in conjunction with this technique. *As of Android 4.0 (API Level ...


2

I had a similar issue. Check if the content of hosts ends with a line feed. The trailing line feed is required.


2

You've missed that the /system file system is mounted read-only. mount -o remount,rw /system cd /system/etc vim hosts # edit, save, then make /system read-only again: mount -o remount,ro /system


2

If you encrypt the hosts file, the system won't be able to read the file, so it won't work any more. But there's no need: since you need root access to edit the hosts file anyway, any app that you don't grant root access won't be able to edit the file.


2

I finally resolved this on my own. After lots of DNS logging I found the necessary. hostnames. s.youtube.com s.ytimg.com youtubei.googleapis.com yt3.ggpht.com


2

If you want to redirect www.youtube.com to 127.0.0.1 you have to add it exactly that way to your hosts files. However you only redirected the main domain youtube.com to 127.0.0.1. not the subdomain www.youtube.com. Note that this does not affect subdomains. If you want to cut of Youtube completely you have to add every subdomain to your hosts file.


1

So, how can I persuade Termius (free version) to understand local network host names? In fact you have to persuade Android OS, not a specific app. Resolving hostnames is handled by Android's C library to which apps are linked through APIs at the time of compiling. On the PC I can simply issue the command putty fred@servername and I can login without ...


1

You cannot do this without root access. The instructions given in that link are conceptually wrong to begin with. The fact that he was able to push a file into system partition implies that he had elevated privilege to remount system partition and write into it. Clearly, the instructions cannot fit under "Non root method" category. If you are into blocking ...


1

Step by Step Don’t Create the AVD with Google Play image. Use for example Google APIs Intel x86 Atom System Image. Start the emulator with the following command… emulator.exe –avd <avd name> -writable-system For example: C:\Users\ilyas.mamun\AppData\Local\Android\Sdk\emulator>emulator.exe -avd Pixel_API_25 -writable-system emulator: ...


1

There is an other way to manipulate the /etc/hosts (You need a Linux machine ) Use the system.img which come from Google go to your Android SDK home cd $ANDROID_HOME find the right system.img for your emulator sudo mount -w system-images/android-25/google_apis/x86_64/system.img edit the /etc/hosts sudo vi /mnt/etc/hosts sudo umount /mnt Create an ...


1

As already suggested by OP, the issue was caused by proxy in APN settings. Disabling proxy in APN settings (which interferes with host blocking usually by ignoring the hosts file) solved the issue.


1

Short answer Ad blockers do not work in Nougat until the developers make an update. A beta version of AdAway does the trick but requires to check the new "Systemless mode" in Preferences screen. Other ad blockers will probably implement similar solutions Long answer This is marked Community Wiki for others to contribute. The explanation is not fully ...


1

Make sure you turn off Data Saver and any proxies. From the Google Chrome Support Page: "If you're using Data Saver, keep in mind that: ... • Changes you made to your /etc/hosts file won't work." Source: https://support.google.com/chrome/answer/2392284


1

This is not possible. You can, however, run your own DNS server on a local network, that could emulate this behaviour on all appliances that are connected via it.


1

To expand on the update that was made by the OP: Chrome stores its own DNS cache for sites that you have visited. This cuts down on DNS resolution time when browsing sites that you have recently visited. However, this happens before the hosts file is checked for DNS resolution (so your new hosts entries will not be checked if they are in the Chrome DNS). ...


Only top voted, non community-wiki answers of a minimum length are eligible