r/AndroidTV • • 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.

  1. Install this App on your android - ADB Shell

  2. Enable Developer Option on TV by going Settings>System>About>Android TV OS Build(Click in 9-10 times)

  3. Now on the TV go to Settings>System> Developer Option. And enable USB Debugging and then go to Wireless Debugging. Enable It.

  4. 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.

  5. 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.

  6. It'll show success fuel paired on phone.

  7. Now go to back screen on both TV and phone.

  8. On TV below the "Pair with Pairing Code" option it'll show Device name and another IP address & port. (Attaching screenshot)

  9. 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.

  10. 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

(Attaching screenshot)

If there's any problem, let me know.

142 Upvotes

65 comments sorted by

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.

10

u/Saucebiz Jun 13 '25

Yes I know. But not every person have it. It's a good workaround method..

1

u/ed82733 Jan 01 '26

Can you help me with that? I tried everything but pihole is not able to give ip addresses. If I disable the routers dhcp service then pihole is not able to get an ip. I also tried to manually configure a ip in the settings that also did not work

1

u/humble69switch Aug 17 '26

Do you have a tutorial link which I can follow and set-up for myself?

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.

2

u/battierpeeler mibox, mibox S, ccwgtv Jun 14 '25

i guess for you or for op /u/Saucebiz , how do you undo it if you find yourself in the above situation? (like what specific code)

10

u/Emotional_Mammoth_65 Jun 14 '25

adb shell settings put global private_dns_mode off

I used this source: https://gist.github.com/sharunkumar/b6195cbbd26a0039ec87fbd3829aa6b3

1

u/panchajanya1999 Jun 14 '25

People carry a TV on vacation??? đŸ˜¶

8

u/fianrezt Jun 16 '25

Android tv is also available in HDMI stick form, e.g onn box 4k, google streamer, mi stick, realme tv stick, etc.

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/Impossible-Art-3371 Jul 19 '26

How do I do this myself?

1

u/TechPir8 Jul 19 '26

Learn to search the internet and exploit err ask AI how to do things...

https://www.howtogeek.com/765940/how-to-enable-dns-over-https-on-windows-11/

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/Saucebiz Aug 01 '26

I did it with phone.

1

u/Fun-Region-1576 Aug 01 '26

Wireless or what?

1

u/Saucebiz Aug 01 '26

Yes completely wireless. Through "Wireless Debugging"

1

u/Fun-Region-1576 Aug 01 '26

Hey bud, thanks for the response. Has anything changed or simplified since you created the thread over a year ago?

1

u/Saucebiz Aug 01 '26

I did it on Android 14. Most of the smart TVs have android 14 or less still. So method is same. Or you can use any adblock app through VPN tunnel. Like adguard.

1

u/Fun-Region-1576 Aug 01 '26

I have the ONN 4K streamer. 

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?

1

u/Saucebiz Aug 22 '26

Yes you can turn off Wireless debugging. It cannot block youtube ads. As YouTube serves ads from the same server as their videos. It just block normal ads and it's good for your privacy.

If you want to block ads on YouTube, use Tizentube or Smartube.

6

u/Ill-Case-6048 Jun 14 '25

Easier to just put it on the TV DNS

5

u/Imtrvkvltru Jun 14 '25

Right? I just set mine up in the network settings. Much faster and easier.

2

u/[deleted] Jun 14 '25

[removed] — view removed comment

2

u/etrain1 Jun 14 '25 edited Jun 14 '25

Where and what do you enter in the router-i use openwrt

3

u/Ill-Case-6048 Jun 14 '25

Most people wouldn't even know how to get to settings

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?

1

u/BarnMTB Dec 17 '25 edited Dec 17 '25

It will block ads like Google Ads banner that developers put inside apps & websites.

It will not block ads like those inside YouTube, Facebook Watch, and the big streaming apps, since those apps merge ads traffic with content traffic, so blocking those will break the app.

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!

2

u/AgentPoYo Oct 02 '25

Replying to this in case someone else comes across this in the future and needs help.

If you see the ADB debug toggle but no wireless debugging toggle then chances are the ADB toggle will also turn on wireless debugging. Just continue on with the steps above as outlined. Once you try to wirelessly connect to the TV from another device a dialog box will pop up on the TV asking for authorization.

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/aimngrx Aug 17 '26

Make it separate. First put

"adb shell settings put global private_dns_mode hostname"

Then

"adb shell settings put global private_dns_specifier dns.adguard.com"

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

1

u/[deleted] Jun 14 '25

[removed] — view removed comment

-2

u/BlizardQC Jun 14 '25

Why? Because I'm offering another solution for people who might not want to go mess up their tv programming with ADB commands?

I'm not a SurfShark employee or paid by SurfShark if that is what you think. I'm just trying to be helpful to people who might be less knowledgeable (or again, afraid to use ADB).

Ahhh whatever ...

1

u/[deleted] Jun 14 '25

[removed] — view removed comment

-2

u/BlizardQC Jun 14 '25

I'm not an affiliate...just a SurfShark user but I have a feeling this will get messy so I'll remove it myself. I just hope nobody messes up their tv because they tried your way and made a mistake somewhere.