apktool
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
java -jar apktool.jar d [file.apk] -o [folder]
java -jar apktool.jar b [folder] -o [file.apk]
ShakaApktool
usage: ShakaApktool s[mali] [options] [--] [<smali-file>|folder]*
assembles a set of smali files into a dex file
-?,--help 显示帮助文本后退出.为调试选项指定的两倍
-a,--api-level <API_LEVEL> 将按照API级别生成文件信息, 例如.14是ICS. 如果不指定, 默认为 15 (ICS).
-f,--list-fields <FILE> Lists all the field references to FILE
(<output_dex_filename>.fields by default)
-j,--jobs <NUM_THREADS> 可用线程数量.默认为内核允许的数量,最大可调至6
-m,--list-methods <FILE> Lists all the method references to FILE
(<output_dex_filename>.methods by default)
-o,--output <FILE> dex文件名将被记录,默认命名为 out.dex
-t,--list-types <FILE> Lists all the type references to FILE
(<output_dex_filename>.types by default)
-v,--version 查看版本信息
-x,--allow-odex-instructions 允许 odex 指令编译进 dex 文件.仅支持少数命令 -
那些可以存放至固定代码路径并且不会导致 dalvik 拒绝的类
-X,--experimental 启用实验操作码进行编译,即使还不一定被Android运行支持
调试选项:
-T,--print-tokens 显示每个完成的名字及文本
-V,--verbose-errors 生成详细错误信息
******************** baksmali ********************
usage: ShakaApktool bs|baksmali [options] <dex-file>
disassembles and/or dumps a dex file
-?,--help 显示帮助文本后退出.为调试选项指定的两倍
-a,--api-level <API_LEVEL> The numeric api-level of the file
being disassembled. 如果不指定, 默认为 15
(ICS).
-b,--no-debug-info 不输出debug信息 (.local, .param, .line,
etc.)
-c,--bootclasspath <BOOTCLASSPATH> A colon-separated list of
bootclasspath jar/oat files to use
for analysis. Add an initial colon
to specify that the jars/oats should
be appended to the default
bootclasspath instead of replacing
it
-d,--bootclasspath-dir <DIR> 目录文件夹搜索 bootclasspath 文件.默认至当面目录
-e,--dex-file <DEX_FILE> 搜索文件名为 DEX_FILE 的dex文件,默认至
classes.dex
-f,--code-offsets 反编译时添加注释包含代码的每个偏移
-i,--resource-id-files <FILES> the resource ID files to use, for
analysis. A colon-separated list of
prefix=file pairs. For example
R=res/values/public.xml:android.R=$A
NDROID_HOME/platforms/android-19/dat
a/res/values/public.xml
-j,--jobs <NUM_THREADS> 可用线程数量.默认为内核允许的数量,最大可调至6
-k,--check-package-private-access When deodexing, use the
package-private access check when
calculating vtable indexes. It
should only be needed for 4.2.0
odexes. The functionality was
reverted for 4.2.1.
-l,--use-locals output the .locals directive with
the number of non-parameter
registers, rather than the .register
directive with the total number of
register
-li,--load-inline-method <file> load inline method resolver from
file
-m,--no-accessor-comments don't output helper comments for
synthetic accessors
-n,--normalize-virtual-methods Normalize virtual method references
to the reference the base method.
-o,--output <DIR> the directory where the disassembled
files will be placed. The default is
out
-p,--no-parameter-registers use the v<n> syntax instead of the
p<n> syntax for registers mapped to
method parameters
-r,--register-info <REGISTER_INFO_TYPES> print the specificed type(s) of
register information for each
instruction. "ARGS,DEST" is the
default if no types are specified.
Valid values are:
ALL: all pre- and post-instruction
registers.
ALLPRE: all pre-instruction
registers
ALLPOST: all post-instruction
registers
ARGS: any pre-instruction registers
used as arguments to the instruction
DEST: the post-instruction
destination register, if any
MERGE: Any pre-instruction register
has been merged from more than 1
different post-instruction register
from its predecessors
FULLMERGE: For each register that
would be printed by MERGE, also show
the incoming register types that
were merged
-s,--sequential-labels create label names using a
sequential numbering scheme per
label type, rather than using the
bytecode address
-t,--implicit-references Use implicit (type-less) method and
field references
-v,--version 查看版本信息
-x,--deodex deodex the given odex file. This
option is ignored if the input file
is not an odex file
-X,--experimental enable experimental opcodes to be
disassembled, even if they aren't
necessarily supported in the Android
runtime yet
调试选项:
-D,--dump-to <FILE> dumps the given dex file into a single annotated
dump file named FILE (<dexfile>.dump by default),
along with the normal disassembly
-I,--ignore-errors ignores any non-fatal errors that occur while
disassembling/deodexing, ignoring the class if
needed, and continuing with the next class. The
default behavior is to stop disassembling and exit
once an error is encountered
-N,--no-disassembly suppresses the output of the disassembly
-T,--inline-table <FILE> specify a file containing a custom inline method
table to use for deodexing
java -jar ShakaApktool.jar d [file.apk] -o [folder]
java -jar ShakaApktool.jar b [folder] -o [file.apk]
问题记录
apk回编的时候出现:error=206, 文件名或扩展名太长
出现这个问题是因为反编译后在目标目录下的apktool.yml文件记录的doNotCompress内容太多。使用ShakaApktool3.0.0.jar版本代替Apktool.jar可以解决。