In many APK applications on the Internet, the author adds ads to free versions, and a large number of de-advertising versions appear on the Internet. In addition, there are some software that will pop up at startup, either useless prompts or suggestions for registration. Android enthusiasts are keen to download these Android software without ad-free pop-up windows. The reason is also very simple and looks comfortable to use.
In this section, we will briefly study how these advertisements and pop-up windows are removed.
Of course, all the modifications here are based on the decompilation of apktool. As mentioned in the previous article, let's talk about the core part.
The object of the experiment is also a simple self-written APK. The image is as follows:
Ad
The simplest method of AD removal:Modify the width and height attributes of imageview in layout to 0dip.
In this way, the part length and width of the displayed ad are changed to zero. The advantage of this operation is that it is simple. The disadvantage is that the image still exists and occupies resources. If it is an online advertisement, it will be downloaded from the Internet. Of course, downloading images consumes a certain amount of traffic.
Relatively thorough ad Removal Methods: Taking imageview as an example. The methods for loading images (or animations) in imageview include setimagebitmap, setanimation, setbackgrounddrawable, and draw. Find these functions in smali, then use # To comment out the part. As follows:
Then, set the width and height of the imageview in layout to 0dip. (to avoid program errors, it is not recommended to delete them)
If it is a network image, there will be a network download step, and you can comment out all the corresponding steps. You can set the URL to null by simply modifying the vertex. In this example
Const-string V6, "http://www.baidu.com/img/logo-yy.gif"
Change
Const-string V6 ,""
In this way, the APK cannot be downloaded from the specified address to the image.
Pop-up window
In this example, the pop-up window in this example is from alertdialog. you can comment out the Code related to the entire builder and alertdialog, and simply modify the show event comment. As follows:
Finally, let's test it!