首先,到官网下载apktool需要的工具:https://ibotpeaches.github.io/Apktool/.
下载地址:https://ibotpeaches.github.io/Apktool/install/
具体的安装步骤:
Installation for Apktool
- Windows:
- Download Windows wrapper script (Right click, Save Link As
)apktool.bat
- Download apktool-2 (find newest here)
- Rename downloaded jar to
apktool.jar
- Move both files (
&apktool.jar
) to your Windows directory (Usuallyapktool.bat
)C://Windows
- If you do not have access to
, you may place the two files anywhere then add that directory to your Environment Variables System PATH variable.C://Windows
- Try running apktool via command prompt
- Download Windows wrapper script (Right click, Save Link As
- Linux:
- Download Linux wrapper script (Right click, Save Link As
)apktool
- Download apktool-2 (find newest here)
- Make sure you have the 32bit libraries (
) downloaded and installed by your linux package manager, if you are on a 64bit unix system.ia32-libs
- (This helps provide support for the 32bit native binary aapt, which is required by apktool)
- Rename downloaded jar to
apktool.jar
- Move both files (
&apktool.jar
) toapktool
(root needed)/usr/local/bin
- Make sure both files are executable (
)chmod +x
- Try running apktool via cli
- Download Linux wrapper script (Right click, Save Link As
- Mac OS X:
- Download Mac wrapper script (Right click, Save Link As
)apktool
- Download apktool-2 (find newest here)
- Rename downloaded jar to
apktool.jar
- Move both files (
&apktool.jar
) toapktool
(root needed)/usr/local/bin
- Make sure both files are executable (
)chmod +x
- Try running apktool via cli
- Download Mac wrapper script (Right click, Save Link As
Note - Wrapper scripts are not needed, but helpful so you don’t have to type java -jar apktool.jar over and over.
说的很清楚了,我们下载的apktool工具需要重命名为apktool.jar,同时把apktool.bat也下载下来放在一个文件夹下。
apktool功能用法:
usage: apktool [-q|--quiet OR -v|--verbose] empty-framework-dir [options]
-f,--force Force delete destination directory.
-p,--frame-path <dir> Stores framework files into <dir>.
上示例:
$ apktool d test.apk
I: Using Apktool 2.2.1 on test.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: 1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
$ apktool b test
I: Using Apktool 2.2.1 on test
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
I: Building apk file...
I: Copying unknown files/dir...
反编译apk:
java -jar apktool.jar d demo.apk
编译成apk:
java -jar apktool.jar b -d demo -o debug.apk
签名方法:
jarsigner -verbose -keystore demo.keystore -signedjar test_signed.apk test.apk mykey
# test_signed.apk是签名之后的文件
# test.apk是需要签名的文件
# mykey 昵称
例如:
jarsigner -verbose -keystore demo.keystore -signedjar test_signed.apk test.apk key_nickname