41.Android aaptツール
41.Android aaptツールAndroid aaptツール aapt紹介 aapt環境構成 aapt list aapt dump aapt package その他命令
aapt紹介
公式文書を参照してください.http://www.androidcn.net/wiki/index.php/Reference/aapt
aapt stands for Android Asset Packaging Tool and is included 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.
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.
For more usage details, open a terminal, go to the tools/directory, and run the command:
Linux or Mac OS X: ./aapt Windows: aapt.exe
aaptはAndroid Asset Packaging Toolで、SDKのtools/ディレクトリの下にあります.このツールはZIP形式のドキュメント添付ファイル(zip,jar,apk)を表示、作成、更新することができます.リソースファイルをバイナリファイルにコンパイルすることもできます.
aaptツールを直接使用したことがないかもしれませんが、build scriptsとIDEプラグインはこのツールを使用してapkファイルをパッケージしてAndroidアプリケーションを構成します.
詳細については、ターミナルコンソールを開き、tools/ディレクトリの下でコマンド:Linux or Mac OS X:./aapt Windows:aapt.exeを実行します.
aapt環境構成
aaptツールは、Windows環境であれば、直接環境変数にPATHを配置し、 Mac環境では、Oh My Zshを使用していますので、直接
コマンドラインの下にaaptと入力します.
aaptのすべてのコマンドと、コマンドに対応するパラメータが表示されます.
aapt list
aapt l[ist] [-v] [-a] file.{zip,jar,apk} List contents of Zip-compatible archive.apkディレクトリの表示: apkディレクトリを表示し、 apkディレクトリの詳細表示: aapt dump
aapt d[ump] [–values] [–include-meta-data] WHAT file.{apk} [asset [asset …]] strings Print the contents of the resource table string pool in the APK. 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. configurations Print the configurations in the APK. xmltree Print the compiled xmls in the given assets. xmlstrings Print the strings of the given compiled xml assets.apk:package、sdkValersion、targetSdkValersion、アプリケーション-label、launchable-activity、feature-groupなどの情報を表示: apk権限の表示: apkリソースの表示: apk構成の表示: xmlのツリー構造を表示: xml内のすべてのstringを表示: 情報表示後出力ファイル: aapt package R.javaの生成:プロジェクトディレクトリの下にナビゲート リソースファイルを生成するか、プロジェクトディレクトリの下に配置するか その他のコマンド
aaptバージョンの出力
aapt v[ersion] Print program version.
apkで指定したファイルを削除
aapt r[emove] [-v] file.{zip,jar,apk} file1 [file2 …] Delete specified files from Zip-compatible archive.
指定ファイルをapkに追加
aapt a[dd] [-v] file.{zip,jar,apk} file1 [file2 …] Add specified files to Zip-compatible archive.
aapt紹介
公式文書を参照してください.http://www.androidcn.net/wiki/index.php/Reference/aapt
aapt stands for Android Asset Packaging Tool and is included 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.
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.
For more usage details, open a terminal, go to the tools/directory, and run the command:
Linux or Mac OS X: ./aapt Windows: aapt.exe
aaptはAndroid Asset Packaging Toolで、SDKのtools/ディレクトリの下にあります.このツールはZIP形式のドキュメント添付ファイル(zip,jar,apk)を表示、作成、更新することができます.リソースファイルをバイナリファイルにコンパイルすることもできます.
aaptツールを直接使用したことがないかもしれませんが、build scriptsとIDEプラグインはこのツールを使用してapkファイルをパッケージしてAndroidアプリケーションを構成します.
詳細については、ターミナルコンソールを開き、tools/ディレクトリの下でコマンド:Linux or Mac OS X:./aapt Windows:aapt.exeを実行します.
aapt環境構成
aaptツールは、
sdk/buid-tools/android-[version]/aapt
にあります.sdk/buid-tools/android-[version]
に指定すればよい.vi ~/.zshrc
で、以下は私の構成です:# Add Android build-tools AAPT variable
AAPT_HOME=/Users/CaMnter/Android/adt-bundle-mac-x86_64-20140702/sdk/build-tools/23.0.2
export AAPT_HOME
export PATH=$PATH:$AAPT_HOME
コマンドラインの下にaaptと入力します.
aaptのすべてのコマンドと、コマンドに対応するパラメータが表示されます.
aapt list
aapt l[ist] [-v] [-a] file.{zip,jar,apk} List contents of Zip-compatible archive.
aapt l *.apk
aapt l -v *.apk
Method:圧縮形式、DeflateまたはStoredを表形式で出力します.Ratio:圧縮率CRC-32:サイクル冗長検査aapt l -a *.apk
aapt d[ump] [–values] [–include-meta-data] WHAT file.{apk} [asset [asset …]] strings Print the contents of the resource table string pool in the APK. 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. configurations Print the configurations in the APK. xmltree Print the compiled xmls in the given assets. xmlstrings Print the strings of the given compiled xml assets.
aapt d badging *.apk
aapt d permissions *.apk
aapt d resources *.apk
aapt d configurations *.apk
aapt d xmltree *.apk res/*.xml
aapt d xmlstrings *.apk res/*.xml
aapt d ... >*.txt
表示出力:aapt package -m -J ~/temp/ -S app/src/main/res -I /Users/CaMnter/Android/adt-bundle-mac-x86_64-20140702/sdk/platforms/android-23/android.jar -M /Users/CaMnter/GitHub/AndroidLife/app/src/main/AndroidManifest.xml
-J~/temp/:出力ディレクトリ-S app/src/main/resの設定:リソースファイルresディレクトリ-I/Users/CaMnter/Android/adt-bundle-mac-x 86_64-20140702/sdk/platforms/android-23/android.jar:android.jarパス**-M/Users/CaMnter/GitHub/Android Life/app/src/main/Android Manifest.xml:**Android Manifest絶対パスaapt package -f -M /Users/CaMnter/GitHub/AndroidLife/app/src/main/AndroidManifest.xml -S app/src/main/res -A app/src/main/assets -I /Users/CaMnter/Android/adt-bundle-mac-x86_64-20140702/sdk/platforms/android-23/android.jar -F ~/log/resouces
***-M/Users/CaMnter/GitHub/Android Life/app/src/main/Android Manifest.xml:**Android Manifest絶対パス-S app/src/main/res:リソースファイルresディレクトリ-A app/src/main/assets:assetsディレクトリ-I/Users/CaMnter/Android/adt-bundle-mac-x 86_64-20140702/sdk/platforms/android-23/android.jar:android.jarパス-F~/log/resouces:resouces.arsc格納パスaaptバージョンの出力
aapt v[ersion] Print program version.
apkで指定したファイルを削除
aapt r[emove] [-v] file.{zip,jar,apk} file1 [file2 …] Delete specified files from Zip-compatible archive.
指定ファイルをapkに追加
aapt a[dd] [-v] file.{zip,jar,apk} file1 [file2 …] Add specified files to Zip-compatible archive.