APKTool 提取APK文件的资源

Posted 蝈蝈俊的技术心得

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了APKTool 提取APK文件的资源相关的知识,希望对你有一定的参考价值。

APK文件本身是一个压缩包,直接用解压工具即可打开,但里面的文件都已被编码为二进制文件格式,不能直接看,比如程序描述文件androidManifest.xml。

使用apktool工具可以将这些文件解码还原出来。apktool(http://code.google.com/p/android-apktool/  现在地址是: http://ibotpeaches.github.io/Apktool/ )是一个非常著名的开源工具包,功能很强大,可以解包APK文件并重新打包,常用来汉化Android应用。

安装方法,参看 http://ibotpeaches.github.io/Apktool/install/

Quick Check

  • Apktool 2.x (Versions after 1.5.2)
    1. Is Java 1.7 installed?
    2. Does executing java -version on command line / command prompt return 1.7?
    3. If not, please install Java 7 and make it the default.

Installation for Apktool 2.x

  • Windows:
    1. Download Windows wrapper script (Right click, Save Link As apktool.bat)
    2. Download apktool-2 (find newest here)
    3. Rename downloaded jar to apktool.jar
    4. Move both files (apktool.jar & apktool.bat) to your Windows directory (Usually C://Windows)
    5. If you do not have access to C://Windows, you may place the two files anywhere then add that directory to your Environment Variables System PATH variable.
    6. Try running apktool via command prompt
  • Linux:
    1. Download Linux wrapper script (Right click, Save Link As apktool)
    2. Download apktool-2 (find newest here)
    3. Make sure you have the 32bit libraries (ia32-libs) downloaded and installed by your linux package manager, if you are on a 64bit unix system.
    4. (This helps provide support for the 32bit native binary aapt, which is required by apktool)
    5. Rename downloaded jar to apktool.jar
    6. Move both files (apktool.jar & apktool) to /usr/local/bin (root needed)
    7. Make sure both files are executable (chmod +x)
    8. Try running apktool via cli
  • Mac OS X:
    1. Download Mac wrapper script (Right click, Save Link As apktool)
    2. Download apktool-2 (find newest here)
    3. Rename downloaded jar to apktool.jar
    4. Move both files (apktool.jar & apktool) to /usr/local/bin (root needed)
    5. Make sure both files are executable (chmod +x)
    6. Try running apktool via cli

Note - Wrapper scripts are not needed, but helpful so you don’t have to type java -jar apktool.jar over and over.

 

我这里没法把他们放在 bin 目录下, 而是放在了  /software/android/tools  目录下。

这样,我解压缩下载目录下的一个apk文件,就是下面命令:

/software/android/tools/apktool d  ~/Downloads/com.supercell.clashofclans_v8.116.2-722_Android-4.0.3.apk

解压缩后的目录是: /software/android/tools/ 下面目录。

参数说明:

apktool d [demo.apk]  // 参数是 d 而不是 -d。

./apktool
Apktool v2.0.3 - a tool for reengineering Android apk files
with smali v2.1.0 and baksmali v2.1.0
Copyright 2014 Ryszard Wi?niewski <[email protected]>
Updated by Connor Tumbleson [email protected]

 

usage: apktool
-advance,--advanced   prints advance information.
-version,--version    prints the version then exits


usage: apktool if|install-framework [options] <framework.apk>
-p,--frame-path <dir>   Stores 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 is apk.out
-p,--frame-path <dir>   Uses framework files located in <dir>.
-r,--no-res             Do not decode resources.
-s,--no-src             Do not decode sources.
-t,--frame-tag <tag>    Uses 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 is dist/name.apk
-p,--frame-path <dir>   Uses framework files located in <dir>.

For additional info, see: http://ibotpeaches.github.io/Apktool/
For smali/baksmali info, see: https://github.com/JesusFreke/smali


以上是关于APKTool 提取APK文件的资源的主要内容,如果未能解决你的问题,请参考以下文章

Android反编译和二次打包

反编译 APKTool 逆向助手

APK .

Android APK反编译

反编译Android APK的具体步骤是怎样的

mac下反编译apk