[APP][ROOT/NONROOT][OFFICIAL] AdAway v5.4.0

jfreund

Senior Member
Jan 26, 2011
54
11
28
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

See the screenshot
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.
 

Attachments

zgfg

Senior Member
Oct 10, 2016
4,835
2,143
233
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.
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)
 

Attachments

Last edited:

jfreund

Senior Member
Jan 26, 2011
54
11
28
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)
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.
 

Attachments

Last edited:

wudini

Senior Member
Mar 25, 2011
103
15
48
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
I deactivated StevenBlack Unified hosts (i think i added this list) and now everything works fine.
 

DiamondJohn

Recognized Contributor
Aug 31, 2013
4,796
3,926
243
Sydney
I deactivated StevenBlack Unified hosts (i think i added this list) and now everything works fine.
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.
 

zgfg

Senior Member
Oct 10, 2016
4,835
2,143
233
Hmm, there are several versions of Steven Black Unified hosts file but the largest one should not exceed 100K of blocked domains:
 

zgfg

Senior Member
Oct 10, 2016
4,835
2,143
233
That's the number of blocked hosts of all lists i use without Steven Blaks list.
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)
 
Last edited:

DiamondJohn

Recognized Contributor
Aug 31, 2013
4,796
3,926
243
Sydney
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)
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:
 

DiamondJohn

Recognized Contributor
Aug 31, 2013
4,796
3,926
243
Sydney
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.
 

DiamondJohn

Recognized Contributor
Aug 31, 2013
4,796
3,926
243
Sydney
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:
Code:
...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
Code:
02-18 19:29:26.299  7486  7637 E DatabaseUtils: Writing exception to parcel
02-18 19:29:26.299  7486  7637 E DatabaseUtils: 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
02-18 19:29:26.299  7486  7637 E DatabaseUtils:     at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:820)
02-18 19:29:26.299  7486  7637 E DatabaseUtils:     at com.android.externalstorage.ExternalStorageProvider.enforceReadPermissionInner(ExternalStorageProvider.java:147)
02-18 19:29:26.299  7486  7637 E DatabaseUtils:     at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684)
02-18 19:29:26.299  7486  7637 E DatabaseUtils:     at android.content.ContentProvider$Transport.query(ContentProvider.java:239)
02-18 19:29:26.299  7486  7637 E DatabaseUtils:     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:106)
02-18 19:29:26.299  7486  7637 E DatabaseUtils:     at android.os.Binder.execTransactInternal(Binder.java:1154)
02-18 19:29:26.299  7486  7637 E DatabaseUtils:     at android.os.Binder.execTransact(Binder.java:1123)
02-18 19:29:26.310  7486  7637 E DatabaseUtils: Writing exception to parcel
02-18 19:29:26.310  7486  7637 E DatabaseUtils: 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
02-18 19:29:26.310  7486  7637 E DatabaseUtils:     at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:820)
02-18 19:29:26.310  7486  7637 E DatabaseUtils:     at com.android.externalstorage.ExternalStorageProvider.enforceReadPermissionInner(ExternalStorageProvider.java:147)
02-18 19:29:26.310  7486  7637 E DatabaseUtils:     at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684)
02-18 19:29:26.310  7486  7637 E DatabaseUtils:     at android.content.ContentProvider$Transport.enforceFilePermission(ContentProvider.java:674)
02-18 19:29:26.310  7486  7637 E DatabaseUtils:     at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:548)
02-18 19:29:26.310  7486  7637 E DatabaseUtils:     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:327)
02-18 19:29:26.310  7486  7637 E DatabaseUtils:     at android.os.Binder.execTransactInternal(Binder.java:1154)
02-18 19:29:26.310  7486  7637 E DatabaseUtils:     at android.os.Binder.execTransact(Binder.java:1123)
--------- beginning of crash
02-18 19:29:26.320  7291  7746 E AndroidRuntime: FATAL EXCEPTION: pool-5-thread-3
02-18 19:29:26.320  7291  7746 E AndroidRuntime: Process: org.adaway, PID: 7291
02-18 19:29:26.320  7291  7746 E 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
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at android.os.Parcel.createException(Parcel.java:2357)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at android.os.Parcel.readException(Parcel.java:2340)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:153)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:781)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1983)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1798)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at android.content.ContentResolver.openInputStream(ContentResolver.java:1475)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at org.adaway.model.source.SourceModel.readSourceFile(SourceModel.java:445)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at org.adaway.model.source.SourceModel.retrieveHostsSources(SourceModel.java:356)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at org.adaway.ui.home.HomeViewModel.lambda$sync$2(HomeViewModel.java:164)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at org.adaway.ui.home.HomeViewModel.lambda$sync$2$HomeViewModel(Unknown Source:0)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at org.adaway.ui.home.-$$Lambda$HomeViewModel$j_0zmZEk5rhV-J-l8ERca_ZLZZA.run(Unknown Source:2)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
02-18 19:29:26.320  7291  7746 E AndroidRuntime:     at java.lang.Thread.run(Thread.java:923)
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.
 

zgfg

Senior Member
Oct 10, 2016
4,835
2,143
233
My problems are back. -.-
I try the same lists with DNS66, AdAway's VPN is based on DNS66 right ?
Why don't you disable all other hosts sources and try them one by one.
If I recall correctly, you had no problem having 600K blocked domains - hence your problem is likely not in the number of 60K hosts listed in a particular source but in the content (which hosts it tries to block) in that source

In that case you would have couple of options:
- give up of that particulat hosts source
- find out what it blocks that disturbes your apps and add those hosts (your apps need) to your Allowed list
- whitelist particular apps (yes, that is possible in VPN mode), those whitelisted apps will completely bypass AdAway or DNS66

Btw, with 600K or 700K of blocked domains you are certainly in the 95/5 or even 98/2 or so position: 98% of the hosts that you keep in your Blocked list are all together no more used (being ever attempted to be reached by your apps) than in 2% of cases (and most of them absolutely never)

Finally, if your phone is not rooted and you cannot use hosts mode (or you don't want to try it), you can disable/uninstall AdAway (or DNS66) app and enable instead (applicable to Android 9 or higher) Private DNS from your native phone Settings, pointing it to dns.adguard.com or dns-family.adguard.com (if you also want to block porn)

In that case your phone (AdAway, DNS66 or Blokada app) will not maintan your blocked list but the adguard DNS server will do it all for you, hence you could not have issues with the size of the list or so.
Also, in that case you cannot maintain your Allowed list.
At least, you can give it a try - since recently I'm using it in parallel with AdAway but in the hosts/root mode and I'm happy with (Private DNS cannot be turned on in parallel with AdAway in VPN mode, or with Blokada or DNS66)
 
Last edited:

wudini

Senior Member
Mar 25, 2011
103
15
48
Very detailed answer, thank you, i appreciate that.

I already know all the other options, i used adaway for years @ root and also blokada, i also have a lifetime license for adguard. ;)
I thought i give adaway a try, did not go so well.

As i said i tested DNS66 and it works well.

I found out today that whenever i add a list, i have to kill adaway to get i working as it should.

Example:

Install adaway
  • wifi works
  • turn off wifi and switched to mobile connection -> works
add any list and update
  • wifi works
  • turn off wifi, no connection on mobile connection
When i kill the adaway process and then start it, it works, how long ? I don't know.
I think there is a problem with the update process of the lists.
 

gallegonovato

Member
Feb 25, 2021
6
0
1
Good afternoon:
I am contacting you as I want to install the Codeberg source https://codeberg.org/baobab/hosts/raw/branch/master/hosts
Adaway initially installs it. But it always disappears from the counter of the number of hosts when you click on check for updates. But in the counter of fonts that need to be updated it says zero. Or it says others but not that one. Actually that one never comes up for update but if you go to the host lists. Under https://codeberg.org/baobab/hosts/raw/branch/master/hosts it appears in English it needs updating for a few minutes. Or in Spanish "Actualizada para pocos minutos". Or in Spanish needs update in a few minutes.
And all other fonts work fine.
Thanks for your time and help


 

zgfg

Senior Member
Oct 10, 2016
4,835
2,143
233
Good afternoon:
I am contacting you as I want to install the Codeberg source https://codeberg.org/baobab/hosts/raw/branch/master/hosts
Adaway initially installs it. But it always disappears from the counter of the number of hosts when you click on check for updates. But in the counter of fonts that need to be updated it says zero. Or it says others but not that one. Actually that one never comes up for update but if you go to the host lists. Under https://codeberg.org/baobab/hosts/raw/branch/master/hosts it appears in English it needs updating for a few minutes. Or in Spanish "Actualizada para pocos minutos". Or in Spanish needs update in a few minutes.
And all other fonts work fine.
Thanks for your time and help
You probaby mean hosts, not fonts and Hosts sources list (not hosts list, that would be hosts file what is different)

When I open in browser your hosts source I see that it lacks the timestamp when the file was last time updated - maybe that's the reason for AdAway not properly showing if/when it needs to be updated
 

DiamondJohn

Recognized Contributor
Aug 31, 2013
4,796
3,926
243
Sydney
Good afternoon:
I am contacting you as I want to install the Codeberg source https://codeberg.org/baobab/hosts/raw/branch/master/hosts
Adaway initially installs it. But it always disappears from the counter of the number of hosts when you click on check for updates. But in the counter of fonts that need to be updated it says zero. Or it says others but not that one. Actually that one never comes up for update but if you go to the host lists. Under https://codeberg.org/baobab/hosts/raw/branch/master/hosts it appears in English it needs updating for a few minutes. Or in Spanish "Actualizada para pocos minutos". Or in Spanish needs update in a few minutes.
And all other fonts work fine.
Thanks for your time and help
Are you sure you want to use this hostfile? I had a quick look, and near the top it had sites like: www.google.com
 

gallegonovato

Member
Feb 25, 2021
6
0
1
You probaby mean hosts, not fonts and Hosts sources list (not hosts list, that would be hosts file what is different)

When I open in browser your hosts source I see that it lacks the timestamp when the file was last time updated - maybe that's the reason for AdAway not properly showing if/when it needs to be updated
good evening: Thank you very much for your help and time but what scares me is that adaway. There are days that he recognizes it well and days that he does not. It must be because of what he tells me

but I use https://gitlab.com/Jorgu81/hosts/-/raw/e8f754d47f463cb77e7e2870b76d5ec06f48e819/HostsGoogle or https://gitlab.com/Jorgu81/hosts/raw/master/Mozilla and they work without problems. It is only with the codeberg links that Adaway does not recognize it well and gives me those glitches.



A hug
 
Last edited:

gallegonovato

Member
Feb 25, 2021
6
0
1
Are you sure you want to use this hostfile? I had a quick look, and near the top it had sites like: www.google.com
good evening: if I would like to use the host on the mobile. and I'm still thinking about passing it to the pc. since in the mobile I do not use anything from Google. I have lineageos 17.1 without any gaps. And nothing from Google. I do not use anything that is not free, that is, no Google service. I use metager for example as a search engine. Or searx. Then I use fennec from fdroid or iceraven with a user.js set. And the things that could have lineageos with Google, such as the time and others modified and changed and I do not miss anything. And while the mobile lasts I will continue like this, then I will try to migrate to Grapheneans without catching the mobile to Google. that is to say second-hand or do the same thing that I have now in a oneplus. A hug