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:~$