1、到官网下载以下文件:apktool1.5.2.tar.bz2和apktool-install-linux-r05-ibot.tar.bz2。
2、解压后得到aapt、apktool、apktool.jar三个文件,将它们全部拷贝至/usr/bin目录下。
3、终端输入apktool即可。
我的做法是把三个文件放在了我的android-adk-linux目录下。(tools与platform-tools目录已经在系统环境变量里声明过了)
aapt本身在platform-tools目录下就已经有一个了,因为大小一样我就没有覆盖。
apktool放在tools目录下,apktool.jar放在了tools/lib目录下。接着对apktool文件做一点小小的修改:
原代码:
jarfile=apktool.jar
libdir="$progdir"
if [ ! -r "$libdir/$jarfile" ]
then
echo `basename "$prog"`": can't find $jarfile"
exit 1
fi
修改为:
jarfile=apktool.jar
libdir="$progdir"
if [ ! -r "$libdir/$jarfile" ]
then
libdir=`dirname "$progdir"`/tools/lib
fi
if [ ! -r "$libdir/$jarfile" ]
then
libdir=`dirname "$progdir"`/lib
fi
if [ ! -r "$libdir/$jarfile" ]
then
echo `basename "$prog"`": can't find $jarfile"
exit 1
fi
终端:
lyw@Inspiron:~$ 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 <brut.alll@gmail.com>
Updated by Connor Tumbleson <connor.tumbleson@gmail.com>
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
lyw@Inspiron:~$