文章目录
- 简述
- 工具
- 操作步骤
简述
可以从apk安装包中提取出res、AndroidManifest、xml等文件;也可以修改资源文件后rebuild一个apk。
工具
1.官方下载地址
https://apktool.org/
2.操作指令
// 解析apk包
$ apktool d test.apk
// 重新rebuid apk包
$ apktool b test
3.安装指导
此处安装的是linux环境下的
4.按照以下步骤下载并保存脚本文件
Linux
1.Download the Linux wrapper script. (Right click, Save Link As apktool)
2.Download the latest version of Apktool.
3.Rename the downloaded jar to apktool.jar.
4.Move both apktool.jar and apktool to /usr/local/bin. (root needed)
5.Make sure both files are executable. (chmod +x)
6.Try running apktool via CLI.
5.下载jar包
链接:https://bitbucket.org/iBotPeaches/apktool/downloads/
下载最新版本即可
6.按照步骤4和5最终显示
7.验证安装
输入apktool 命令行,如出现以下提示,说明配置成功:
$ apktool
Apktool 2.9.3 - a tool for reengineering Android apk files
with smali v3.0.3 and baksmali v3.0.3
Copyright 2010 Ryszard Wiśniewski <brut.alll@gmail.com>
Copyright 2010 Connor Tumbleson <connor.tumbleson@gmail.com>
usage: apktool
-advance,--advanced Print advanced information.
-version,--version Print the version.
usage: apktool if|install-framework [options] <framework.apk>
-p,--frame-path <dir> Store framework files into <dir>.
-t,--tag <tag> Tag frameworks using <tag>.
usage: apktool d[ecode] [options] <file_apk>
-f,--force Force delete destination directory.
-o,--output <dir> The name of folder that gets written. (default: apk.out)
-p,--frame-path <dir> Use framework files located in <dir>.
-r,--no-res Do not decode resources.
-s,--no-src Do not decode sources.
-t,--frame-tag <tag> Use framework files tagged by <tag>.
usage: apktool b[uild] [options] <app_path>
-f,--force-all Skip changes detection and build all files.
-o,--output <dir> The name of apk that gets written. (default: dist/name.apk)
-p,--frame-path <dir> Use framework files located in <dir>.
For additional info, see: https://apktool.org
For smali/baksmali info, see: https://github.com/google/smali
操作步骤
1.解析apk
apktool d app-signed.apk
$ apktool d app-signed.apk
I: Using Apktool 2.9.3 on app-signed.apk
I: Loading resource table...
I: Decoding file-resources...
I: Loading resource table from file: /home/lizhengcao/.local/share/apktool/framework/1.apk
I: Decoding values */* XMLs...
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
I: Baksmaling classes.dex...
I: Baksmaling classes10.dex...
I: Baksmaling classes11.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes4.dex...
I: Baksmaling classes5.dex...
I: Baksmaling classes6.dex...
I: Baksmaling classes7.dex...
I: Baksmaling classes8.dex...
I: Baksmaling classes9.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
会生成一个app-signed文件夹,里面就是我们反编译出来的文件,内容如下所示:
可以看到里面有AndroidManifest.xml文件和res文件夹,这些是需要的