Current location - Health Preservation Learning Network - Healthy weight loss - How to remove the advertising code from the Android source code
How to remove the advertising code from the Android source code
Please clean up the advertisement before installation.

The general idea of this method is to decompile the APK file (compilation can be understood as transforming the source code into a runnable program, and decompilation means transforming the program into the source code), then modify the XML file (usually main.xml in the decompiled res folder, usually in the layout folder, and sometimes in other folders) to remove the advertising information, and finally recompile it into a new APK file.

Let's talk about the specific operation process. First, you need to install the Java environment on your computer (you can download and install it in www.java.com), then download the apktool at /E /e/ 15app.htm, extract the aptool.jar to c:windows, and extract the apktool-install-windows.zip to any folder (such as the root directory of disk D).

Run the command prompt and use the cd command to go to the folder where apktool-install-windows is located (such as cd d:/ apktool). If the installation file name of the embedded advertisement is abcd. APK, execute the following command to decompile abcd.apk into the folder abcd:

apktool d abcd

Now open the abcd folder, find main.xml in the res folder, then open it with Notepad, press "Ctrl+F" to find fill_parent and wrap_content, replace them with 0.0dip, save and exit, and then enter the following command to recompile:

Apktool b ABCD

Next, you can find the regenerated apk file in the path of ABCDdistout.apk, and finally sign the APK file with tools such as APKsign to use it.