View the original post on Musing.io
If you are talking about app's ad then it could be blocked by using ad blocker. If your phone has root permission then try root adblocker app.This will block ad surely as it has the administration.
If phone is not rooted then you can try ad blocker vpn or some ad blocker app which works in some cases.
If it's with a app then i will suggest you not to block them if ads not bother you too much as the creator gets some revenue from it and he deserve it.
But if you get ads while using phone and ad appears anywhere and anytime then this is firmware vulnerability issue. This couldn't be fixed in a such a way but need to flash the official firmware again. These happens with lower budget device which has a firmware with low security. My friend also faced this problem and solved by flashing firmware.
You can try doing so. i hope it will also work for you.