Modify APK for Android

Source: Internet
Author: User
Tags unpack

How to modify the APK file [APK file modification, icon, beautification, advertising] Full tutorial


How to modify an APK file? For example, the English version is simplified to Chinese, beautify, modify functions, icons, Modify text descriptions, and remove advertisements. This article describes the basic knowledge, structure, unpackage, package, and signature of the APK file, as well as regular modification to the APK file. In fact, it is very simple. If it is too troublesome, Please bypass.
1. First, build the JDK environment. Click here to download
After the download, click Install. Then set the runtime environment parameters:

Right-click my computer and choose Properties> advanced> environment variables.

System variable-> New-> variable name: java_home variable value: D: \ Program Files \ Java \ jdk1.7.0 (this is my installation path, this is not fixed, for example, you install to C: \ Program Files, enter c: \ Program Files \ Java \ jdk1.7.0)

System variable-> edit-> variable name: path is added at the beginning of the variable value: % java_home % \ bin; (if a path item already exists, you do not need to create a new one, add directly to the backend, but use it; separate it from the existing items)

System variable-> New-> variable name: classpath variable value:

.; % Java_home % \ Lib \ DT. jar; % java_home % \ Lib \ tools. jar;

Finally, test whether the environment variables are set successfully.

Click Start Menu-run-Enter cmd-press ENTER-enter javac

1. If the following information appears:

Usage: javac <option> <Source File>

Possible options include:

-G generates all debugging information

-G: None does not generate any debugging information

-G: {lines, vars, source} only generates some debugging information

-Nowarn does not generate any warning

-Verbose outputs messages about the operations being performed by the compiler.

-Deprecation: output the source location of an outdated API

-Classpath <path> specifies the location for searching user class files.

-CP <path> specifies the location for searching user-class files

-Sourcepath <path> specifies the location of the Input Source file to be searched.

-Bootclasspath <path> overwrites the position of the boot class file

-Extdirs <directory> overwrites the location of the installed extension directory.

-Endorseddirs <directory> overwrites the location of the standard path of the signature.

-D <directory> specifies the location where the generated class files are stored.

-Encoding <encoding> specifies the character encoding used by the source file.

-Source <version> provides source compatibility with the specified version.

-Target <version> generates class files of a specific VM version.

-Version Version Information

-Help: output the summary of standard options.

-X outputs a feed of non-standard options

-J <flag> directly transmits the <flag> to the runtime system

Congratulations, your Java environment variable configuration is successful!

2. if:

'Javac' is neither an internal or external command nor a running program.

Or batch files.

This shows that the Java environment variable configuration has failed. Check it carefully!

2. Download The apktool Toolkit (which includes the apktools decompilation tool and apksign signing tool ). Download the notepad Code Editor (smali and XML files can be modified ).
Before modification, you should first have an understanding of the internal structure of the APK file:

Global configuration file of androidmanifest. xml Program

Classes. Dex this is the Dalvik bytecode

Resources. ARSC compiled binary resource file

META-INF \ This directory stores signature information

Res \ This directory stores resource files

Assets \ This directory can store some configuration files
Make some basic comments and introductions to these files and directories:

• Androidmanifest. xml

This file is a file that every application must define and contain. It describes the name, version, permission, and referenced library file of the application. You must unpack the package before reading it.

• Classes. Dex File

Classes. Dex is a Java bytecode file generated after Java source code compilation. Dex is the full name of Dalvik VM executes, that is, the android Dalvik execution program, not the Java me bytecode but the Dalvik bytecode.

• Resources. ARSC

The compiled binary resource file.

• META-INF catalog

The META-INF directory stores signature information to ensure the integrity of the APK package and system security. When eclipse compiles an APK package, it will do a verification calculation for all the files to be packaged, and put the calculation result under the META-INF directory. This ensures that the files in the APK package cannot be replaced at will. For example, after obtaining an APK package, if you want to replace an image, a piece of code, or a piece of copyright information, it is basically impossible to directly decompress, replace, and re-package the package. This increases the difficulty of virus infection and malicious modification, and helps protect the security of the system.

• Res directory

The res directory stores resource files. Including images and strings.

After unpacking, almost all possible modifications and edits are here.

• Assets Directory

The Assets Directory can store some configuration files. The content of these files can be obtained through related APIs during the program running.
To modify an APK file, you must first unpackage the APK file (also decompile the file, and open apktool.exe,

In the APK decompilation area on the left, select the APK file, select the file storage directory, and click the decompilation APK button to obtain the decompilation file.



3. Start Modification

1. If you only need to replace the image, there is no need to unpack or package it. Use WinRAR to open the APK file and replace it directly. However, if you want to modify the text and other non-image content, you can only unpack the content, modify the content, compile it back, and finally add the signature to the mobile phone for installation. The following describes how to unpack and package an APK.

2. Chinese APK Software

In the res folder, we can see that there are many values-*** folders, which are language packs. Values is an English Language Pack, values-ZH is a Chinese Language Pack (including Hong Kong, Macao, Taiwan and the mainland), and values-ZH-RCN is a simplified Chinese Language Pack (only including the Mainland ), values-ZH-RTW is a Chinese Traditional Language Pack (Hong Kong, Macao and Taiwan ). In addition, language packs in other regions are simplified objects.

In the values folder, there are usually arrays. XML, strings. xml and other language files. To make Chinese files, you must modify these files. Sometimes you also need to modify other XML files and view them one by one. After modification, package, sign, and OK.

3. Modify the desktop icon name (Label)

Each APK file has an "icon tag ". After installing the APK program on your mobile phone, the icon label text is displayed under the icon. The content of this icon label can be modified. Find strings. xml under \ res \ values and modify one line:

Icon label

For example, enable the mute mode.

Similarly, if the window plug-in is used, modify widget_name.

Note: The APK in system/APP cannot be modified because the corresponding odex file must be modified at the same time.

After modification, package, sign, and OK.

4. Remove the advertisement in APK

Many APK applications carry advertisements. To remove the advertisement in the program, modify the content related to the advertisement in the main. xml file. Find the main. xml file in the \ res directory. It is usually stored in the \ Layout directory and is sometimes stored in other directories. Sometimes, the main. xml file does not exist, and the advertisement line is placed in other XML files. You can only search for files one by one. In either case, you can see a similar command as follows. This is the advertisement display.


Change it:


As you can see, the key is to change fill_parent to 0.0dip, and change wrap_content to 0.0dip. Keep the rest unchanged. In this way, the advertisement is not displayed. Of course, you will not be able to see the advertisement.

After modification, package, sign, and OK.

5. Change the display battery to 1% precision.

On xt502, only 7 files are displayed by default: 0%, 10%, 20%, 40%, 60%, 80%, and 100%. You can change the display precision by modifying framework-res.apk. However, some mobile phones prove that the best possible accuracy is only 10%. The modification is as follows:

(1) Unpack framework-res.apk

(2) modify and add the battery status icon

(3) modify the stat_sys_battery.xml file.

(4) modify the stat_sys_battery_charge.xml file.

(5) Packaging

(6) extract stat_sys_battery.xml, stat_sys_battery_charge.xml, resources. ARSC, and a directory named drawable-mdpi.

(7) reassemble framework-res.apk

6. Status Bar information notification text color modification

The color of the State column information notification text is controlled by the colors. xml file under Res \ values in the framework-res.apk file, so we only need to modify the colors. xml file. In addition, this file also controls the text color in the drop-down bar, which can be modified.

Open the colors. xml file in the text editor and find

# Ff000000

Modify this sentence to: # ffffffff

The text color of the status bar information is changed from black to white.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.