Android aapt usage Summary

Source: Internet
Author: User

Aapt stands for Android asset packaging tool and is supported in the tools/directory of the SDK. this tool allows you to view, create, and update zip-compatible archives (ZIP, jar, APK ). it can
Also compile resources into binary assets.

Aapt is the android asset packaging tool, which is under the tools/directory of the SDK. this tool allows you to view, create, and update file attachments in ZIP format (ZIP, jar, APK ). you can also compile a resource file into a binary file.

Though you probably won't often use aapt directly, build scripts and IDE plugins can utilize this tool to package the APK file that constitutes an Android Application.

Although you may not have used the aapt tool directly, the build scripts and IDE plug-ins use this tool to package the APK file to form an Android Application.

For more usage details, open a terminal, go to the tools/directory, and run the command:

For more information, open the terminal console, go to the tools/directory, and run the following command:

Linux or Mac OS X:

./Aapt

Windows:

Aapt.exe

 

 

 

 

This article summarizes the usage of this tool.
1. aapt L [ist] [-V] [-A] file. {zip, jar, APK}
List contents of zip-compatible archive.
1.1 List compressed file directories
Aapt L <file_path.apk>
Parameters:
-V: The directory will be output in the form of a table, the table's tables are: length, method, size, ratio, date, time, CRC-32, name.
The method indicates the compression format, which can be deflate or stored. The zip directory adopts the compression mode or storage mode. ARSC ,*. PNG adopts the compression mode, while others adopt the compression mode.
Ratio indicates the compression rate. CRC-32 did not understand what it meant, sodino hope to advise.

-A: The contents of all directories are output in detail.
: Aapt_list.jpg
 


2. aapt d [UMP] [-- values] What file. {APK} [asset [asset...]
Badging print the label and icon for the app declared in APK.
Permissions print the permissions from the APK.
Resources print the resource table from the APK.
Deployments print the deployments in the APK.
Xmltree print the compiled xmls in the given assets.
Xmlstrings print the strings of the given compiled XML assets.

2.1 view packagename, versioncode, applicationlabel, launcheractivity, permission, and other details of the APK package.
Aapt dump badging <file_path.apk>
: Aapt_dump_badging.jpg
 

2.2 view Permissions
Aapt dump permissions <file_path.apk>
: Aapt_dump_permissions.jpg

 

2.3 view resource list
Aapt dump resources <file_path.apk>
Generally, a lot of information is output. To view all information, use the following two sentences:
Aapt dump resources <file_path.apk> sodino.txt
Sodino.txt
In this way, all the information will be output to the sodino.txt file through the redirection character ">", and then open the file to view it.


2.4 view APK configuration information
Aapt dump configurations <file_path.apk>


2.5 view the specified XML file of the specified APK.
Aapt dump xmltree <file_path.apk> Res/***. xml
XML Information output in a tree structure.
Aapt dump xmlstrings <file_path.apk> Res/***. xml
Output all the string information in the XML file.
: Aapt_dump_xmltree.jpg

 

3
Because the amount of code here is large, I wrote a batch processing form.

Use aapt to generate R. Java
The project directory under the REM test must have the gen folder; otherwise, the system will prompt: Unable to open class file R. Java: no such file or directory.
% Aapt % package-F-m-J % Gen %-S % res %-I % android_jar %-M % android_manifest_xml %

Use aapt to generate resource package files
% Aapt % package-F-M % android_manifest_xml %-S % res %-A % assets %-I % android_jar %-F % resource %

% Gen %: Path of the stored R. Java folder.
% Res %: res folder path.
% Android_jar %: The referenced Android. Jar path.
% Android_manifest_xml %: absolute path of androidmanifest. xml.
% Assets %: asset folder path.
% Resource %: The generated resouces. ARSC storage path.

Refer:
Android command line manual compilation and packaging
Http://blog168.chinaunix.net/space.php? Uid = 22957718 & Do = Blog & cuid = 2322671

 

For the rest, see:
Aapt R [emove] [-v] file. {zip, jar, APK} file1 [file2...]
Delete specified files from zip-compatible archive.

Aapt A [DD] [-v] file. {zip, jar, APK} file1 [file2...]
Add specified files to zip-compatible archive.

Aapt V [ersion]
Print program version.
: Aapt_r_a_v.jpg

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.