[Tutorial] How to remove any Ads on any apk without root

Search This thread

Nrin

Member
Apr 11, 2017
7
20
Hello,

Today I want to share with you a method to remove any ads from an apk that should work on any Android version without root permissions.

You will need a minimum level of skills to understand the method and a computer (needed to edit the apk).

Obtain the apk
When you install an application, its apk will be placed in /data/app directory. However, you need a rooted phone to access that directory. Luckily, often there is a pre-installed system application to backup your apps (on Huawei there is Huawei Backup) that can access that folder. Thus, you don't need root permissions. You can use this backup pre-installed app to save your apk on the sd and transfer it on your computer.

Edit the apk and re-install it
I'm assuming that you're on Linux, but the same can be done with Windows or Mac. Continue with the following steps:
  1. An apk is just a zip file, thus extract it in a folder. On Linux:
    Code:
    $ unzip com.example.apk
  2. Now, try to look at the strings, regarding ads, in plain text inside the file classes.dex (you don't need to extract it). For example:
    Code:
    $ strings classes.dex | grep "ads"
  3. Keep note about all the ads urls contained in classes.dex (e.g. googleads.g.doubleclick.net)
  4. Use an hex editor as GHex or Bless to replace these ads urls with invalid urls (I suggest to use the same length). So, for example, you can transform: googleads.g.doubleclick.net into foobarfoo.b.arfoobarfoo.bar.
  5. Save overwriting the original classes.dex and zip all the files into a new apk (e.g. com.example_noads.apk)
  6. Sign the new apk. The process is easier using some tools (look for apk signer on google, there are one click tools).
  7. Transfer the new apk on your phone and install it (the phone should ask if you want to upgrade your app, say yes).

In this way, the application should work as always, but it will try to load the ads from invalid urls. Thus, it should not display any ads.

Note: I've tested this method and it works, however it's possible that some applications are encrypted thus there aren't plain text ads urls.

EDIT: I added a new step where you must sign the new apk. In fact, this is the rule. However, when I wrote this post I didn't talk about that, because in my case I found an application that I succesfully re-installed without re-sign the apk (bug? hash collision? I still don't know).
 
Last edited:

Nrin

Member
Apr 11, 2017
7
20
Application implementing this method available: Purify

I developed an application to do all this process directly and automatically on your phone!
The application is still unmature, consider it a proof of concept. It will remove only google ads for the moment.
Click here to see the source code on GitHub

If you want to try the compiled apk:


Note: This is the first pre-release, keep in mind that it is just an example of implementation. Some purified applications could crash, for example because they don't handle the wrong urls or for other reasons. However, I tested it on some apps and it seems to work. Unpacking, editing and re-packing the apk can require few minutes. Please read further details on the github page linked above.
 

azigta

Member
Feb 12, 2011
14
7
Hey there, thank you very much, I used Purify on android 8.0 and works great. It didn't sign my apk but I signed it from the pc and it installed and worked correctly without ads. Great!

Edit: Zipsigner isn't on the play store any more but I downloaded and installed the apk from apkpure and it signs it but doesn't do it well because it doesn't let me install it after that no matter what kind of sign type do I use. So I sign it from the pc using "signapk"
 
Last edited:
  • Like
Reactions: adeii

phanimitra vadlamani

Senior Member
Oct 26, 2016
51
3
Nice app.....now a days ads from other sources are increasing such as facebook.ads, mobileads, inmobi,etc.....to my knowledge, manifest.xml contains every ad activity, service, receiver etc.....is it possible to add an interface to selectively remove those....so that i can remove any ad from any app.......by the way....thanks for your work?
 

pankajk

New member
Jul 30, 2015
1
1
Is it still working because I have tried on latest android version where I followed the below step and I got the error as "There was a parsing issue with the package".
1. Downloaded APK file and renamed it's extension from .apk to .zip.
2.Extracted the files in one folder and edited classes.dex file using HxD editor and searched for "https://googleads.g.doubleclick.net" and replaced with "https://foobarfoo.b.arfoobarfoo.bar".
3. Later I zipped back and renamed the file from .zip to .apk.
4. Generated keystore using jdk keytool and signed with jarsigner. for more information(https://stackoverflow.com/questions/4853011/how-to-sign-an-android-apk-file)
5. Did Zipalign using the above mentioned link and transferred file to my Android 10 OS .

Can anybody help if there is any problem with app signing or compressing the files. thanks
 
  • Like
Reactions: King Arc s

BanCoolin

New member
Aug 23, 2021
1
0
Application implementing this method available: Purify

I developed an application to do all this process directly and automatically on your phone!
The application is still unmature, consider it a proof of concept. It will remove only google ads for the moment.
Click here to see the source code on GitHub

If you want to try the compiled apk:


Note: This is the first pre-release, keep in mind that it is just an example of implementation. Some purified applications could crash, for example because they don't handle the wrong urls or for other reasons. However, I tested it on some apps and it seems to work. Unpacking, editing and re-packing the apk can require few minutes. Please read further details on the github page linked above.

I did all as you said and I have apk
icallscreen_82_9601261.apk-purified.apk
bat I can't install it?!?!
 
Last edited:

ApkFit

New member
May 15, 2022
1
0
Turbo League Apk Download Free Game App For Android and iOS(Latest Version) - Turbo League MOD APK is a dashing game wherein you control snails instead of vehicles, bicycles, planes, or whatever else. What's more, these aren't simply any snails; they're the quickest snails on earth.
 

sniperwolf64

Senior Member
Aug 18, 2011
598
117
Hello, im looking for an app that can remove all kind of ads in apk other than google, like ads shown by modders in the aps. will attach a screenshot which shows an ad from modder for one app in first thing after installing the app and opening it.
WhatsApp Image 2022-06-22 at 10.35.45 PM.jpeg
 

acotizer1

New member
Jun 23, 2022
1
0
Acotizer.com is a website specialized in reviews of monitors or gaming monitors, accessories, and everything related to this type of monitor. We hope you find all the information you need before buying your 144hz monitor, model analysis, and recommendations depending on your budget.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    Hello,

    Today I want to share with you a method to remove any ads from an apk that should work on any Android version without root permissions.

    You will need a minimum level of skills to understand the method and a computer (needed to edit the apk).

    Obtain the apk
    When you install an application, its apk will be placed in /data/app directory. However, you need a rooted phone to access that directory. Luckily, often there is a pre-installed system application to backup your apps (on Huawei there is Huawei Backup) that can access that folder. Thus, you don't need root permissions. You can use this backup pre-installed app to save your apk on the sd and transfer it on your computer.

    Edit the apk and re-install it
    I'm assuming that you're on Linux, but the same can be done with Windows or Mac. Continue with the following steps:
    1. An apk is just a zip file, thus extract it in a folder. On Linux:
      Code:
      $ unzip com.example.apk
    2. Now, try to look at the strings, regarding ads, in plain text inside the file classes.dex (you don't need to extract it). For example:
      Code:
      $ strings classes.dex | grep "ads"
    3. Keep note about all the ads urls contained in classes.dex (e.g. googleads.g.doubleclick.net)
    4. Use an hex editor as GHex or Bless to replace these ads urls with invalid urls (I suggest to use the same length). So, for example, you can transform: googleads.g.doubleclick.net into foobarfoo.b.arfoobarfoo.bar.
    5. Save overwriting the original classes.dex and zip all the files into a new apk (e.g. com.example_noads.apk)
    6. Sign the new apk. The process is easier using some tools (look for apk signer on google, there are one click tools).
    7. Transfer the new apk on your phone and install it (the phone should ask if you want to upgrade your app, say yes).

    In this way, the application should work as always, but it will try to load the ads from invalid urls. Thus, it should not display any ads.

    Note: I've tested this method and it works, however it's possible that some applications are encrypted thus there aren't plain text ads urls.

    EDIT: I added a new step where you must sign the new apk. In fact, this is the rule. However, when I wrote this post I didn't talk about that, because in my case I found an application that I succesfully re-installed without re-sign the apk (bug? hash collision? I still don't know).
    8
    Application implementing this method available: Purify

    I developed an application to do all this process directly and automatically on your phone!
    The application is still unmature, consider it a proof of concept. It will remove only google ads for the moment.
    Click here to see the source code on GitHub

    If you want to try the compiled apk:


    Note: This is the first pre-release, keep in mind that it is just an example of implementation. Some purified applications could crash, for example because they don't handle the wrong urls or for other reasons. However, I tested it on some apps and it seems to work. Unpacking, editing and re-packing the apk can require few minutes. Please read further details on the github page linked above.
    1
    Hey there, thank you very much, I used Purify on android 8.0 and works great. It didn't sign my apk but I signed it from the pc and it installed and worked correctly without ads. Great!

    Edit: Zipsigner isn't on the play store any more but I downloaded and installed the apk from apkpure and it signs it but doesn't do it well because it doesn't let me install it after that no matter what kind of sign type do I use. So I sign it from the pc using "signapk"
    1
    Is it still working because I have tried on latest android version where I followed the below step and I got the error as "There was a parsing issue with the package".
    1. Downloaded APK file and renamed it's extension from .apk to .zip.
    2.Extracted the files in one folder and edited classes.dex file using HxD editor and searched for "https://googleads.g.doubleclick.net" and replaced with "https://foobarfoo.b.arfoobarfoo.bar".
    3. Later I zipped back and renamed the file from .zip to .apk.
    4. Generated keystore using jdk keytool and signed with jarsigner. for more information(https://stackoverflow.com/questions/4853011/how-to-sign-an-android-apk-file)
    5. Did Zipalign using the above mentioned link and transferred file to my Android 10 OS .

    Can anybody help if there is any problem with app signing or compressing the files. thanks