AndroidManifest.xml文件解码反编译两种方法

1.apktool解码反编译AndroidManifest.xml

apktool可以将整个apk文件反编译,这样可以得到解码反编译后的AndroidManifest.xml文件。将下载的apktool1.5.2.tar.bz2和apktool-install-windows-r05-ibot.tar.bz2解压到同一个文件夹中,此时文件夹包含aapt.exe、apktool.jar和apktool.bat三个文件。

1).语法
java -jar apktool.jar d apkfile dir

2).批处理
@echo off
setlocal enabledelayedexpansion
for /f %%i in ('dir /b *.apk') do (
    set file=%%i
    set name=!file:.apk=!
    java -jar apktool.jar d -s %cd%\!file! %cd%\!name!
    move /y %cd%\!name!\AndroidManifest.xml %cd%\AndroidManifest.txt
    rd /s /q %cd%\!name!    
)
start notepad.exe %cd%\AndroidManifest.txt

2.AXMLPrinter2解码反编译AndroidManifest.xml

AXMLPrinter2只能对单个AndroidManifest.xml文件解码反编译。

1).语法
java -jar AXMLPrinter2.jar AndroidManifest.xml > AndroidManifest.txt

2).批处理(借助7z命令行)
@echo off
for /f %%i in ('dir /b *.apk') do (
    7za e %cd%\%%i AndroidManifest.xml
    java -jar AXMLPrinter2.jar %cd%\AndroidManifest.xml > %cd%\AndroidManifest.txt
)
start notepad.exe %cd%\AndroidManifest.txt

3.区别比较

实际测试发现apktool比AXMLPrinter2解码更彻底,对于同一个apk的AndroidManifest.xml解码如下(片断):

apktool:
引用内容 引用内容
<application android:theme="@*android:style/Theme.Black" android:label="@string/app_icon_name" android:icon="@drawable/icon" android:name=".PhoenixApplication">

AXMLPrinter2:
引用内容 引用内容
<application android:theme="@android:01030008" android:label="@7F0C01D8" android:icon="@7F0201A2" android:name=".PhoenixApplication">

4.资源链接

[1].apktool:https://code.google.com/p/android-apktool/
[2].AXMLPrinter2:https://code.google.com/p/android4me/
[3].7-Zip:http://www.7-zip.org/download.html

评论: 0 | 引用: 0 | 查看次数: 27375
发表评论
登录后再发表评论!