Stock Android does not provide a way to edit /etc/hosts directly and rooting phone always comes with some risks. Besides, newer models are usually not supported; usually it takes about a year or two.
personalDNSfilter is a DNS filter proxy that allows you to block ads but also allows you to set extra /etc/hosts. Since my note-taking appliaction is hosted on my old laptop at home and my router does not support NAT loopback, I can’t access to it with my phone within home Wi-Fi. Now it works like a charm.