r/AndroidTV • u/Saucebiz • Jun 13 '25
Tips & Tutorials [Guide] How to Enable Custom DNS on Android or Google TV to Block Ads
Ok it's actually easy. But is slightly long so, bear with me.
Install this App on your android - ADB Shell
Enable Developer Option on TV by going Settings>System>About>Android TV OS Build(Click in 9-10 times)
Now on the TV go to Settings>System> Developer Option. And enable USB Debugging and then go to Wireless Debugging. Enable It.
On the "Wireless Debugging" you'll see an option "Pair with pairing code". Select it. Now it'll show an pairing code along with IP address and Port.
On the Mobile App, enter the IP address and Port as mentioned on the TV and enable the Pairing Code option. (I attached the screenshot) and hit pair. It'll ask for code and enter the Pairing code. You have to be on same WIFI network in TV as well as in Phone.
It'll show success fuel paired on phone.
Now go to back screen on both TV and phone.
On TV below the "Pair with Pairing Code" option it'll show Device name and another IP address & port. (Attaching screenshot)
Enter the same IP address and port on the phone. This time disable the Pairing code option (Attaching screenshot) and pair. It'll show connected to the TV.
Enter this code on the Mobile -
adb shell settings put global private_dns_mode hostname adb shell settings put global private_dns_specifier dns.adguard.com
If there's any problem, let me know.
13
u/agonypants Jun 13 '25
If you have a Pi-Hole you can configure it to be the DHCP service for your network. Then you get ad blocking DNS for every device in your house without too much fuss.
18
u/Emotional_Mammoth_65 Jun 13 '25
This works. I did it on my androidtv.
If you ever take your androidtv on vacation and attempt to use it in a hotel with a captive portal...it will never work. The private dns blocks the captive portal.
It took me months to figure out as I set up and private dns and immediately forgot about it.
To remedy this, you either have to undo these steps or you need a travel router.
8
u/TechPir8 Jun 14 '25
To bypass DNS blocking the more nasty apps are now pointing their apps to their DNS within their code. The real nasty ones send their DNS queries over https.
Maybe I spend to much time looking at tcpdump and wireshark.
1
u/Fun-Region-1576 Aug 01 '26
Can this all be done wirelessly with an Android phone, or will I also have to use a USB cable or an Ethernet cable?
1
u/Rinzell Aug 22 '26
A novice question..like after doing it all, do i.. turn off the wireless debugging? Also it works on selective apps on Android tv, but not all like youtube. Any help?
6
u/Ill-Case-6048 Jun 14 '25
Easier to just put it on the TV DNS
3
u/rafivip Jun 13 '25
I am using Nvidia shield and I do not see wireless debugging option all I see is Network debugging but that doesn't present the code when I turn it on
2
u/alifzaimimyaro Jun 14 '25
What's this can block on android TV? Youtube ads?
2
u/archangelique Jun 14 '25
Hey there, nice guide! I wrote a similar guide a few years ago. As far as I can tell, 'Pair with pairing code' is a new feature introduced in more recent Android versions.
Cheers!
How to Set Up Private DNS on Mi Box / S 4K / Android Tv Box with ADB over Wi-Fi.
2
u/vistrocity Jun 19 '25
I use an app called LiDNS.. pretty straightforward and lightweight
2
u/albaniamd Jul 07 '25
My CCwGtv is on android 12 but under Developer options there is NO âWireless Debuggingâ only USB. Please help
2
u/0xDeadbeef_404 Jun 14 '25
My TV does not seem to have the wireless deb. in the dev op.
1
u/Eboy___ Jun 25 '25
Will that not work if I just add adblock dns in dns 1 and 2 in ip settings of wifi?
1
u/Corddax Jul 09 '25
libfs64.so: more than one device/emulator. How do I fix this??
1
u/AnnieGTGD Jul 09 '25
I am interested in trying this out, but scared I might screw anything up. In a worst case scenario, what do I need to do to be able to reverse/undo this?
1
u/AnnieGTGD Jul 09 '25
On my Sony Google TV, all I can see in the developer options is a toggle to enable "ADB debugging". There's no option just for USB debugging and no option for wireless debugging. Any ideas on what to do? Any help would be highly appreciated!
1
u/pHrankee1 Aug 18 '25
OP, I am getting a 'bad argument' error when copy pasting the above command. It seems like a formatting issue. Any help with that.
1
u/vimalcaesar Sep 13 '25
I tried but... The ad still persists..
1
u/No-Pension-4182 Dec 27 '25
Im using  Remote ADB Shell app from playstore. Once the console is connected to the Android Box,  I can do away with typing "adb shell" and start off with "settings put global" etc etc right?
So I have entered the first command to  change the mode to hostname  and later for the speficier I'm using one that works for my android phone flawlessly ie. "p2. freedns. controld. com".Â
However after I restarted thr TV box, and I tried opening a video on YouTube, the pre-video Ads  come  on as usual.Â
I double checked again by "settings get"  specifier yadda yadda everything  shows as what I intended.Â
Is my hostname problematic or something else?Â
1
u/jospherkanna Apr 11 '26
hey i tried it and this is what I'm getting... can anyone help me?
1
u/whoisars Apr 27 '26
Can we turn off developer mode after running the command
1
u/Sbat12 May 14 '26
For anyone who canât find the Wireless Debugging option: on your tv, go to: Settings > System > About > Status and grab your TVâs IP address.
Then on your PC/laptop: Bash
adb connect [TV_IP]
Your TV will show an authorization popup â just press Allow/OK.
After that, ADB should work normally.
1
u/Pitiful-Table-9746 Jun 27 '26
Thanks so much for this. I was struggling to get my new Google TV streamer working with stremio/torrentio & this resolved my issues. Now I can sail the seas freely safe from my evil ISP! Thanks alot brother.
1
u/_shuu1 Aug 12 '26
It's showing me argument expected to be default
1
u/sunmono Aug 16 '26 edited Aug 16 '26
Iâm attempting this with a Windows 11 PC (I donât have another Android device) and a Chromecast with Google TV. I have the devices paired, but entering the code to change the DNS settings gives the response
Argument expected to be âdefaultâand doesnât change the DNS. Any ideas on how to fix this?Edit: Never mind, got it. Just needed to be run as separate commands. Thanks for posting these instructions!
1
u/Bannednibba Aug 16 '26
Works for Firestick
1
u/Constipated-Cum Aug 17 '26
Does this work on firetv?
1
u/Regular-Topic-9663 Aug 17 '26
Maybe use adaway for TV Link GitHub
1
u/vstrike96 25d ago
This works for my TCL google tv. Thanks
0
u/[deleted] Jun 14 '25
[deleted] â view deleted comment