← 返回命令列表

Linux command

aapt 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List contents

aapt list [app.apk]

Dump

aapt dump xmltree [app.apk] AndroidManifest.xml

Extract package name

aapt dump badging [app.apk]

Package

aapt package -f -M [AndroidManifest.xml] -S [res/] -I [android.jar] -F [output.apk]

说明

aapt (Android Asset Packaging Tool) is a build tool used in Android development to package application resources into APK files. It compiles resources, generates the R.java file containing resource identifiers, and can inspect existing APK files. The tool handles resource compilation, XML processing, asset packaging, and APK creation. It reads AndroidManifest.xml, processes drawable, layout, and other resource files, and bundles them into the final application package. While largely superseded by aapt2 in modern Android development, aapt remains useful for APK inspection and legacy projects.

参数

list
List contents of a ZIP-compatible archive (APK)
dump
Dump specific information from an APK: badging, permissions, resources, configurations, xmltree, xmlstrings
package
Package resources and assets into an APK
-f
Force overwrite of existing files
-M _file_
Specify AndroidManifest.xml location
-S _dir_
Specify resource directory
-I _jar_
Add an existing package to base include set (usually android.jar)
-F _file_
Specify output APK file
-v
Verbose output

FAQ

What is the aapt command used for?

aapt (Android Asset Packaging Tool) is a build tool used in Android development to package application resources into APK files. It compiles resources, generates the R.java file containing resource identifiers, and can inspect existing APK files. The tool handles resource compilation, XML processing, asset packaging, and APK creation. It reads AndroidManifest.xml, processes drawable, layout, and other resource files, and bundles them into the final application package. While largely superseded by aapt2 in modern Android development, aapt remains useful for APK inspection and legacy projects.

How do I run a basic aapt example?

Run `aapt list [app.apk]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does list do in aapt?

List contents of a ZIP-compatible archive (APK)