yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] zgfg:
Ok, but new AdAway does not support http

You can also no more change the path for local hosts file, it must be /system/etc/hosts (check is it supported by your old CM).

You can try by enabling Systemless hosts in Magisk Manager, Settings (then reboot).

Try with and without Systemless hosts (disable Systemless hosts in Magisk Manager, modules tab and reboot)

Btw, make a clean install of the new AdAway (uninstall, reinstall) and then test first only with its default hosts sources, if needed with Systemless hosts, etc

If a particular (your old) host source cannot be updated, paste its URL to browser to check is it maybe dead
[Android Apps and Games] njascgil:
My old CM11 does support /system/etc/hosts. It does not support Magisk neither the newest AdAway.

The hosts sources were entered as http on the oldest AdAway and they are not dead, but the URL might indeed be getting redirected to an (incompatible with v3.3) https URL.

This is no big issue. If I can't make AdAway to work on this old phone, I can manage by manually updating the hosts file once in a while... I was just curious if this downloading issue is to be expected in old phones, even with old(ish) AdAway versions.
[Android Apps and Games] zgfg:
Sorry but all of us here use AdAaway (mostly with Magisk) and it DOES SUPPORT /system/etc/hosts

Of course, on some systens it is necessary to enable Systemless hosts in Magisk.

Look to my previous post and google, read about Systemless hosts if not familiar what, how and why is that

In your shoes, I would go through the clean install and only with the default hosts sources to find what is 'wrong' - AdAway should work

There is also a possibility to use AdAway (talking exclusively about the new, Adaway 5) in the non-root, VPN mode (in that case not using hosts file at all). Again, new clean installation is required to be able to switch to the VPN mode

If there are really problems with AdAway with your old custom ROM, you can report to Github (link from the AdAway app)
[Android Apps and Games] DiamondJohn:
Just to confirm, as I was obviously under the wrong assumption. :oops:

Is the VPN mode actually implemented by AdAway? or does AdAway configure the VPN built into the OS? I was under the (wrong) impression that the VPN was a feature supplied by the OS, but just want it confirmed (i.e. that I was wrong). The reason it makes any difference (apart from the above poster running an older version of android) is that up until a few days ago, although I am rooted, I was running in VPN mode and experienced a few issues with my network (i.e. outside of AdAway). Since switching to systemless host mode, those issues have disappeared.
[Android Apps and Games] zgfg:
You probably thought of Private DNS option that is available in A9 and later:

How To Block Ads On Android Using Private DNS in 2023

Let's admit it: ads are something that we all hate. Ads not only annoy us, but they also ruin our video-watching or web-browsing experience. Furthermore,

techviral.net

If you enable Private DNS (OS feature) and you provide the URL for a DNS resolver blocking the ads, like dns.adguard.com, then it would also block ads for you. In that case you don't need AdAway

It works similarly like AdAway (or DNS66 or Blokada) in VPN mode but then you are stick with only that particular DNS resolver, hence you cannot mix several hosts sources, cannot exclude some sites by whitelisting them as in AdAway, etc

Private DNS can be also used for other needs like for an Intranet DNS resolver or so

Don't use that (OS feature) Private DNS in parallel with AdAway - one would need to investigate which option and how then takes the precedence
[Android Apps and Games] DiamondJohn:
I have built some allow lists, and I was using them when I was in VPN mode, but they didnt appear to be working. After reading the following posts on GitHub, It became clear I may not be using the correct format, or even if it has been implemented.

Allowed list (from local file) not working · Issue #2185 · AdAway/AdAway

Thanks for implementing/fixing the previous #2131 about reading a textual list from local storage. Tested with v5.0.7 and Blocked list and it works However, cannot make it working with Allowed list...

github.com

Do allow lists (from web) work? and if so, what is the expected format?

NB: I am hostinhg them on GitHub, not in a local file.

PS: I went with a simply list of host names
[Android Apps and Games] ipdev:
I am a little confused.

What empty hosts file is created?

What is the contents of system/etc/hosts?

What do you get when you run cat /system/etc/hosts from adb shell or a terminal app?

---

It has been awhile since I used an older Android, let alone system root. ;)

What root are you using?

CM's pre-installed root, SuperSU, phh's SuperUser, KingRoot..

KingRoot is not a good option by the way.

Take a look back in the thread, I know system root was discussed a few times in the last few years.

I did a quick search of my posts, since I remember posting something about it.

Post # 13,538 - Link

Look back and forth a bit from there to see if you can find something that might work for you. Not sure if that was the last time system root was discussed.

CM11 would be KitKat (Android 4.4.x - API/SDK 19)

You could give Magisk a try but, I am not sure how well or what is implemented down that low.

From Magisk README

---

Yes, as long as the hosts file is formatted proper, you can replace/modify it as you wish.

Just make sure you do not omit or delete the localhost entry.

Take a look at your original to see what you need to keep.

Two examples of a default hosts file.

127.0.0.1 localhost
::1	localhost

or

127.0.0.1 localhost
::1	ip6-localhost

Cheers. :cowboy:
[Android Apps and Games] ipdev:
I have been waiting for the documentation on how to do this with the newer/current AdAway. ;)

In the past AdAway, with just host blocking, it was a simple configuration of the hosts file.

To block, the source file was example from hosts.ipfiles.com - website - Link

To allow, the source file was example from hosts.ipfiles.com - website - Link

---

Other ad blocking methods such as DNS66, or Blokada (for example).

The source files would be tagged as blocking or allow when added to the source list.

Normally the leading address 0.0.0.0 or 127.0.0.1(There is no place like home. ;)) would be striped.

The allow sources could be a simple list example from hosts.ipfiles.com - website - Link

Then the blocking sources would be merged and the allowed sources would be removed and a new blocking list would be generated.

---

As jawz101 mentioned in the github issue GitHub - Link

Combine the blocking list(s) and then remove the entries from the combined allow list(s). The end result is a list of blocking only to use as you wish.

And just in case it was missed, the closing of jawz101's comment I linked to in the github issue.

There will be exceptions to this but, proper blocking lists will be maintained and entries will be added and removed.

So best to use well maintained blocking lists, YouTube for example is still blocked on someonewhocares - website - Link

127.0.0.1 s.youtube.com # Blocking this will interfere with video watching history

If you use blocking sources that do not include Dan's list you will have no problem with YouTube history, in turn no need to add an allow exception.

---

Hopefully PerfectSlayer figures out what format the source files should be in and then be able to make it work. ;)

Cheers. :cowboy:
[Android Apps and Games] zgfg:
It's the same problem for Allowed list from https:

How to use Apply allowed hosts option when adding a hosts source? · Issue #2529 · AdAway/AdAway

I want to add a list of allowed hosts, for example: api.micloud.xiaomi.net sgpac.account.xiaomi.com connect.rom.miui.com update.miui.com zgwlc.zagreb.hr magisk-modules-repo.github.io Instead of man...

github.com

I.e., the problem is in parsing the Allowed list, not where from the file comes, local or remote

Yeah, the same simple format for Allowed list uses also DNS66

Some other reasons for that same/simple format for the Allowed list I commented in both Github tickets, for local Allowed list and remote Allowed list (because again, it's the same problem in both cases, they don't work)
[Android Apps and Games] DiamondJohn:
I think the real crux of the issue is coming down with a decision on what the file format would be. I can say this with some certainty, as I have a project here on XDA using a shell script to build a merged host file, and was using it myself until recently, that merges block and allow lists. I went with simple host names in the blocklist Allow(no wildcards), and it was working. i.e. parsing and excluding the allow list from the block list, is not the difficult part. Once you have decided on a format.
[Android Apps and Games] Oswald Boelcke:
Just for clarification. Do you agree that the above statement or recommendation only applies if AdAway is used in VPN mode?

I always have Private DNS enabled (by the way with dns2.digitalcourage.de) and am using AdAway in root mode without any issues.
[Android Apps and Games] zgfg:
I was also interested about but I don't use Private DNS and didn't have time to experiment

You could try the following:

1) Test access to a host that is not blocked by Private DNS but only blocked by hosts file

2) Test access to a host that is not blocked by hosts file but only blocked by Private DNS

For each scenario you need three tests: only Private DNS and then only Adaway (to make sure it is really blocked only by one of them - although for AdAway you can search through the Blocked list), then both enabled together.

Then you can conclude do they really work together or one takes a precedence

Furthirmore, to test also with a host from (2):

3)Test access to a host that is blocked by Private DNS but whitelisted by AdAway

Although, for (3), whitelist in AdAway overwrite if something is blocked by Private DNS
[Android Apps and Games] Oswald Boelcke:
@zgfg To make it more complicated: How about my Pihole. And if not connected to our home network, I always use VPN to our home network (via PiVPN) i.e. when connected to another WiFi network or mobile network. This means, all traffic again goes through our Pihole.
[Android Apps and Games] zgfg:
Ok, so I made few experiments on Xiaomi Mi 9T, Xiaomi.eu A11, AdAway 5.3.0 in the hosts/root mode:

1) Private DNS disabled.

Disable all hosts sources in AdAway.

Manually add only www.cnn.com to the Blocked list in AdAway.

Reboot!

Results:

a) Browser CANNOT open www.cnn.com

b) Browser CAN open a well known porn site

---

2) Phone Settings: Private DNS enabled, set to: dns-family.adguard.com

Keep AdAway as in test (1).

Reboot!

Results:

a) Browser CANNOT open www.cnn.com

b) Browser CANNOT open that well known porn site

---

3) Keep Private DNS as in test (2).

Keep AdAway as in test (1) but add that porn site to the AdAway Whitelist.

Reboot!

Results:

Both (a) and (b) as in Test (2).

---

Conclusion:

Both AdAway in hosts mode and Private DNS block the sites.

I.e., for a site, it is enough to be blocked by at least one of them.

And of course, whitelisted sites in AdAway do not un-block those sites that are blocked by Private DNS

---

Then I wanted to repeat the tests with Adaway in VPN/non-root mode:

In the phone Settings, Apps, Deleted Data for AdAway.

Reopened AdAway and set it to VPN mode (and disabled all hosts sources).

Immediately Private DNS popped-up, complaining that Private DNS cannot be accessed because there is 'no Internet' (screenshot)

Disabled AdAway - popup from Private DNS dissapeared.

Enabled AdAway - a second later Private DNS popped-up the error again.

Conclusion:

Private DNS cannot be enabled if using AdAway in VPN mode.

Perhaps, I could have looked if I can find the Private DNS system app name to whitelist that app from AdAway VPN -but I leave for someone else to further play with
[Android Apps and Games] DiamondJohn:
And just to restate my understanding of allow lists. They are NOT currently supported/functional. To allow a specific chosen host(s) you have to add them as individual allowed hosts.

Please correct me if I have misunderstood all the back and forth.
[Android Apps and Games] pendragon666:
Hi, i have been having issues with adaway on my oxygeos oneplus6t. Adblocking does not start automatically after boot, i have to tap on the app and press the button at the bottom. I use root mode. On my tabs6 in unroot mode it takes the app a good minute to start up after boot but at least it blocks immediatelly. Tried clearing everything and it didnt help. Also, adds get through even with that on. I have them even in xda app right now and adaway tells me it is on.
[Android Apps and Games] DiamondJohn:
In rootmode, once you run the build host file once, you can uninstall AdAway as Magisc (if you are using systemless hosts) takes care of your host file into the system. In root mode, AdAway is simply a tool to update your hostfile. Wihout adaway your old host file is still active.

Check

/system/etc/hosts

and if using Magisc, check

/data/adb/modiles/hosts/system/etc

You are using Magisc systemless hosts? and have enabled it in Magisc?
[Android Apps and Games] pendragon666:
Thanks for the help. I enabled systemless hosts in magisk this morning but the behavior is the same.

My hosts file at above location is empty and 0kb. Weird, what do i need to do to fix this?

Edit: the other one from magisk is also empty

Edit 2: after several reboots both host files are full and 1.7MB. Blocking works and adaway no longer boots to off state. I have no idea what I did or what happened. At one point I even changed permissions from -rw-r-r-- to rw-rw-rw-- but the last reboot reverted that.
[Android Apps and Games] glennza:
For some reason I have started getting "Sponsored" posts in Facebook on all devices. I have had a clean FB feed for years because of Adaway but I think FB must have changed something? I tried adding a couple of "mega" hosts list but it made no difference.

Is anyone else seeing these sponsored ads now?
[Android Apps and Games] DiamondJohn:
today something occured to me to actually take a look. What I found was that with a little SQL, I was able to answer my question using AdAways built in dB. i.e. How many unique hosts are provided by a file, OR how many hosts are in that file that are not in any other source list, OR how many hosts would be excluded from my resultant host file, if I removed that source list.

Now, first thing to remember when looking at the results, just becasuse a source has 30K hosts not in another list, may actually be because all the other lists have dropped that host as its no longer operating (i.e. its dead). The validity of any host or the hosts in the file is a completely different question.

View attachment 5221965]

Also, as we can see in my results, StevenBlacks list only has 0.11% of unique hosts (as a percentage of all hosts within StephenBlack), but that is most likely because I have duplicated the sources used to build StevenBlacks' list.

The SQL: https://del.dog/inicyfinga.txt

NB: Tried to include the SQL in this post, but the forum software spat-the-dummy.
[Android Apps and Games] wesleyjrz:
I was having trouble connecting to the Amazon Shopping app. After many attempts to resolve it, I disabled AdAway and the Amazon app worked fine...
[Android Apps and Games] Oswald Boelcke:
Give it a try with enabled AdAway but disable the AdAway built-in webserver.
[Android Apps and Games] wudini:
I have a problem with the VPN mode on my Pixel 4a @ Android 11.

When i use WiFi and turn it of after a while to use mobile internet i get no internet access, that happens only when Adaway runs for a while.

I already tried to turn off the battery optimization, any ideas ?
[Android Apps and Games] DiamondJohn:
An FYI so you don't feel you are the only one. But the following could just mean we both are/were doing the same stupid thing...

I have a Pixel 4a running the latest A11, rooted. I started out using the VPN mode, and I did not admit to myself at the time (I always blamed it on other mod's), but my network was acting flakey.

The below did not occur all the time, only randomly sometimes.

I couldn't download updates from the playstore, sometimes I couldnt even view it

An SMB2 share on my local computer hesitated for 1-5 seconds (this occurred VERY often)

Web surfing was a little flakey

The VPN would show as having turned itself off.

I thought there was more, but I cannot remember them now. I switched to the systemless host mode, and they all resolved (i.e. never happened again) I am using the same list of host sources.

As no-one else was reporting the same issues, I thought it was something I was doing wrong. I have a LARGE list (>600k) of blocked hosts
[Android Apps and Games] jfreund:
I'm also having this issue. This is NOT a custom ROM, this is the OTA update to OxygenOS 10.3.8 from Oneplus.

Adaway worked perfectly on OxygenOS 10.3.7. Since the update to 10.3.8, Adaway reports that 60889 sites are blocked. This is with root, using hosts file. The file is 1.84MB and if generated by Adaway.

Chrome has Lite Mode DISABLED and still shows ads. Apps like Waze, Transparent Clock and Weather, and File Manager+ show ads. This is the case with and without systemless root in Magisk, with Adaware 5.3 disabled, uninstalled, systemless root changed, then Adaware reinstalled after the change.

Despite Adaware generating the hosts file and reporting that the ad servers are blocked, the apps are ignoring the hosts file and loading ads.

Edit: Disabling/enabling the webserver also has no effect - the ads still come through.
[Android Apps and Games] zgfg:
Did you restart after creating/updating hosts file

You can also try from (some) Terminal app to resolve a host you find it as blocked in AdAway, like:

nslookup 39bola.com

and compare it to (assumming cnn is not blocked):

nslookup www.cnn.com
[Android Apps and Games] jfreund:
Yes, I restarted. Just to be sure, I disabled Adaway, restarted, uninstalled Adaway, restarted, checked the hosts file (34b, only localhost), installed Adaway, loaded hosts, and restarted. Still no ads blocked. Here are shots of the beginning of the hosts file, and the nslookup for CNN and a "blocked" host.
[Android Apps and Games] zgfg:
Frankly, I tested now by nslookup myself, e.g. sites 007angels.com and 00author.com are correctly blocked in Chrome but nslookup still resolves them by use of Google DNS server 8.8.8.8 (thus ignoring the hosts file rule blocking them to 0.0.0.0)
[Android Apps and Games] jfreund:
I use Brave most of the time, but attached is a Chrome screenshot of XDA with ads.

More concerning to me is the lack of ad blocking in apps, as shown in Transparent Clock and Weather, also attached.

Adaway says it's working, but it just isn't blocking anything.
[Android Apps and Games] wudini:
I deactivated StevenBlack Unified hosts (i think i added this list) and now everything works fine.
[Android Apps and Games] DiamondJohn:
It may actually then be the size of the list. The one you deactivated is a big one. However, I have a number of large lists. Although I did not test it, I would assume it is not related to a specific list. *Maybe* its the number of the resultant list that causes android to stall.

Out of interest, how many hosts does it say its blocking now? Now that its working.
[Android Apps and Games] wudini:
566101. :)
[Android Apps and Games] zgfg:
Hmm, there are several versions of Steven Black Unified hosts file but the largest one should not exceed 100K of blocked domains:

hosts/alternates/fakenews-gambling-porn-social/readme.md at master · StevenBlack/hosts

🔒 Consolidating and extending hosts files from several well-curated sources. Optionally pick extensions for porn, social media, and other categories. - StevenBlack/hosts

github.com
[Android Apps and Games] wudini:
That's the number of blocked hosts of all lists i use without Steven Blaks list.
[Android Apps and Games] zgfg:
Ok, I also realized that upon I posted the previous comment

Anyway, I similarly used to parse from up to 20 hosts sources, blocking about 700K domains - but I recently downgraded to 8-10 hosts sources, blocking altogether 100K domains and I don't observe any difference related to the ads (still blocking fine)
[Android Apps and Games] DiamondJohn:
I know I have way to many host sources (but still resulting in less than 700k hosts ;) although I am about to add a few more... ) However, I also know that a few of my lists include malware and a malware advertising and tracking list. The effect of these are not visually apparent to the user. And to be honest, I do try to limit my browsing from suspicious sites/apps. But these are usually the interesting places where all the cool kids hang out...:alien:
[Android Apps and Games] DiamondJohn:
The following needs to be confirmed by someone else, and its pretty minor in itself.

I wanted to add a few hosts sources and a number of allow hosts, which in bulk was easier to do on my PC. So I exported my list to a JSON file, edited the list on my PC and restored the list back into AdAway.

It all went fine, except for a number of my lists that I simply renamed (ie changed the label). The items I renamed (and only changed the name of) still had their old name.

PS: I am now blocking a lot of hosts (but still less than the 700k), and I am getting a little concerned that the AdAway single database file is now over 168MB I dont know at what point sqlite starts to behave badly or poorly, but looking at the contents, it *may* be prudent to break this dB into 2 or more datrabases.
[Android Apps and Games] DiamondJohn:
So now I have added a bunch of new host lists as local files. I keep them in the location:

/sdcard/User/hosts/*

for example:

...snip...

{
"label": "MSW - add.Spam",
"url": "content:\/\/com.android.externalstorage.documents\/document\/primary%3AUser%2Fhosts%2FBadHosts.msw%2Fadd.Spam",
"enabled": true,
"allow": false,
"redirect": false
},

...snip...

I added quite a few files, and most have a large number of hosts. So, I ran it. But somewhere in the proces it crashed, and AdAway just disappeared from the screen without any error message. I tried a few times (not too many....) with the same outcome, so I tried again and took a logcat. I was expecting some kind of complaint about the size, but instead, I got a permissin exception

Spoiler content hidden.

If need be I have athe fyll logat of the process from start to the crash (i.e. I did a logcat -c before I clicked the AdAway refresh / download hosts button.

The crux of it appears to be AndroidRuntime: java.lang.SecurityException: Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/document/primary%3AUser%2Fhosts%2FBadHosts.msw%2Fadd.2o7Net from pid=7291, uid=10271 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs

Is there a permission I need to add? I checked AdAway in the settings, and there was nothing there to add.
[Android Apps and Games] wudini:
My problems are back. -.-

I try the same lists with DNS66, AdAway's VPN is based on DNS66 right ?