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 following figure shows the simplest way to ad images: Modify the width and height attributes of ImageView in layout to 0 dip. 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. 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. You can comment out all the corresponding steps. You can set the Url to null by simply modifying the vertex. In this example, I changed const-string v6, "http://www.baidu.com/img/logo-yy.gif" to const-string v6, "" so that apk could not be downloaded to the image from the specified address. In this example, the pop-up window is from AlertDialog. you can comment out the Code related to the entire Builder and AlertDialog, and simply modify it to annotate the show event. As follows:
Finally, let's test it!