日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

appt使用小结

發布時間:2024/6/21 综合教程 41 生活家
生活随笔 收集整理的這篇文章主要介紹了 appt使用小结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

aapt命令小結

aapt即Android Asset Packaging Tool.本文小結了一下該工具的用法。

1. aapt l[ist] [-v] [-a] file.{zip,jar,apk}
List contents of Zip-compatible archive.
1.1 列出壓縮文件目錄
aapt l <file_path.apk>
參數:
-v:會以table的形式輸出目錄,table的表目有:Length、Method、Size、Ratio、Date、Time、CRC-32、Name。
其中Method表示壓縮形式,有:Deflate及Stored兩種,即該Zip目錄采用的算法是壓縮模式還是存儲模式;可以看出resources.arsc、*.png采用壓縮模式,而其它采用壓縮模式。
Ratio表示壓縮率。CRC-32未明其意,Sodino盼指教。

-a:會詳細輸出所有目錄的內容。
效果圖: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.
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.

2.1 查看apk包的packageName、versionCode、applicationLabel、launcherActivity、permission等各種詳細信息
aapt dump badging <file_path.apk>
效果圖:aapt_dump_badging.JPG

2.2 查看權限
aapt dump permissions <file_path.apk>
效果圖:aapt_dump_permissions.JPG

2.3 查看資源列表
aapt dump resources <file_path.apk>
一般都會輸出很多的信息,如要全部查看,請用下面這兩句:
aapt dump resources <file_path.apk> > sodino.txt
sodino.txt
這樣會把所有的信息通過重定向符">"輸出到sodino.txt文件中,然后再打開該文件即可查看。

2.4 查看apk配置信息
aapt dump configurations <file_path.apk>

2.5 查看指定apk的指定xml文件。
aapt dump xmltree <file_path.apk> res/***.xml
以樹形結構輸出的xml信息。
aapt dump xmlstrings <file_path.apk> res/***.xml
輸出xml文件中所有的字符串信息。
效果圖:aapt_dump_xmltree.JPG

3
由于此處代碼量比較大,本人寫成批處理形式了。

使用aapt生成R.java
rem 測試的工程目錄下必須得有gen文件夾,否則會提示: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%

使用aapt生成資源包文件
%aapt% package -f -M %ANDROID_MANIFEST_XML% -S %RES% -A %ASSETS% -I %ANDROID_JAR% -F %RESOURCE%

%GEN%:存放的R.java文件夾路徑。
%RES%:res文件夾路徑。
%ANDROID_JAR%:引用的android.jar路徑。
%ANDROID_MANIFEST_XML%:工程AndroidManifest.xml絕對路徑。
%ASSETS%:asset文件夾路徑。
%RESOURCE%:生成的resouces.arsc存放路徑。

參考:
Android系列之Android 命令行手動編譯打包詳解
http://blog168.chinaunix.net/space.php?uid=22957718&do=blog&cuid=2322671

其余的不解釋,直接見效果圖:
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

本文內容歸CSDN博客博主Sodino 所有
轉載請注明出處:http://blog.csdn.net/sodino/archive/2011/01/07/6122665.aspx

總結

以上是生活随笔為你收集整理的appt使用小结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。