Aapt is the abbreviation of Android assert packaging tool, which is as follows:
1. List the APK Package content
Aapt L [ist] [-V] [-A] file. {zip, jar, APK}
-V is listed as a table.
-A: details the content.
For example: aapt L <your APK File>. This command is used to view the APK content.
2. view some APK Information
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.
For example, aapt D permissions <APK File> indicates the permission of the APK.
3. Compile Android Resources
Aapt P [ackage] [-D] [-F] [-M] [-u] [-V] [-x] [-Z] [-M androidmanifest. XML]/
[-0 extension [-0 extension...] [-G tolerance] [-J jarfile]/
[-- Debug-mode] [-- Min-SDK-version Val] [-- target-SDK-version Val]/
[-- App-version Val] [-- app-version-Name text] [-- custom-package Val]/
[-- Rename-manifest-package]/
[-- Rename-Instrumentation-target-package]/
[-- UTF16] [-- auto-add-overlay]/
[-- Max-res-version Val]/
[-I base-package [-I base-package...]/
[-A asset-source-Dir] [-G class-list-file] [-P public-definitions-file]/
[-S resource-sources [-s resource-sources...] [-f apk-file] [-j r-file-Dir]/
[-- Product product1, product2,...]/
[Raw-files-dir [raw-files-Dir]...]
This is complicated and only describes several key parameters.
-F if the compiled file already exists, force override.
-M: place the directory of the generated package in the directory specified by the-J parameter.
-J specifies the output directory of the generated R. Java file.
-S res folder path
-A assert folder path
-M androidmanifest. XML Path
-I path of Android. jar of a specific version of the platform
-F specifies the output of the APK file.
For example:
1. compile the project resources into the R. Java File
Aapt package-m-j <R. Java directory>-S <res directory>-I <Android. Jar directory>-M <androidmanifest. xml directory>
2. compile the project resources into a package
Aapt package-F-S <res directory>-I <Android. Jar directory>-A <assert directory>-M <androidmanifest. xml directory>-F <output package directory>
4. Remove files from the packaged APK
Aapt R [emove] [-v] file. {zip, jar, APK} file1 [file2...]
For example, aapt r <your APK File> androidmanifest. xml removes androidmanifest from the APK.
5. Add the file to the packaged APK.
Aapt A [DD] [-v] file. {zip, jar, APK} file1 [file2...]
For example, aapt A <your APK File> <file path to be added> adds the file to the packaged APK file.
6. display the aapt version
Aapt V [ersion]
For example, aapt V is used to print the result Android asset packaging tool, v0.2