1、JADX的下载与使用方法
下载解压缩后的zip文件,进入bin目录并运行:jadx (命令行版本)或者 jadx-gui(图形界面版本)
注意:确保已安装Java 8或更高版本的64位版本。不会安装JDK,
可以参考:Java Oracle JDK在Oracle Solaris、Windows、Linux和Mac上安装配置
1) 手动下载解压
下载地址:https://github.com/skylot/jadx/releases
2) Mac和Linux安装命令
Arch linux:
sudo pacman -S jadx
macOS:
brew install jadx
3) 通过源代码安装(需安装JDK 8或更高版本)
git clone https://github.com/skylot/jadx.git
cd jadx
./gradlew dist
在Windows上,则需使用gradlew.bat代替./gradlew,运行jadx的脚本将被放在build/jadx/bin,并打包到build/jadx-<version>.zip。
4) 图形版JADX
jadx[-gui] [options] <input file> (.apk, .dex, .jar, .class, .smali, .zip, .aar, .arsc)
options:
  -d, --output-dir                    - output directory
  -ds, --output-dir-src               - output directory for sources
  -dr, --output-dir-res               - output directory for resources
  -r, --no-res                        - do not decode resources
  -s, --no-src                        - do not decompile source code
  --single-class                      - decompile a single class
  --output-format                     - can be 'java' or 'json', default: java
  -e, --export-gradle                 - save as android gradle project
  -j, --threads-count                 - processing threads count, default: 4
  --show-bad-code                     - show inconsistent code (incorrectly decompiled)
  --no-imports                        - disable use of imports, always write entire package name
  --no-debug-info                     - disable debug info
  --no-inline-anonymous               - disable anonymous classes inline
  --no-replace-consts                 - don't replace constant value with matching constant field
  --escape-unicode                    - escape non latin characters in strings (with \u)
  --respect-bytecode-access-modifiers - don't change original access modifiers
  --deobf                             - activate deobfuscation
  --deobf-min                         - min length of name, renamed if shorter, default: 3
  --deobf-max                         - max length of name, renamed if longer, default: 64
  --deobf-rewrite-cfg                 - force to save deobfuscation map
  --deobf-use-sourcename              - use source file name as class name alias
  --rename-flags                      - what to rename, comma-separated, 'case' for system case sensitivity, 'valid' for java identifiers, 'printable' characters, 'none' or 'all' (default)
  --fs-case-sensitive                 - treat filesystem as case sensitive, false by default
  --cfg                               - save methods control flow graph to dot file
  --raw-cfg                           - save methods control flow graph (use raw instructions)
  -f, --fallback                      - make simple dump (using goto instead of 'if', 'for', etc)
  -v, --verbose                       - verbose output (set --log-level to DEBUG)
  -q, --quiet                         - turn off output (set --log-level to QUIET)
  --log-level                         - set log level, values: QUIET, PROGRESS, ERROR, WARN, INFO, DEBUG, default: PROGRESS
  --version                           - print jadx version
  -h, --help                          - print this help示例:
 jadx -d out classes.dex
 jadx --rename-flags "none" classes.dex
 jadx --rename-flags "valid,printable" classes.dex
 jadx --log-level error app.apk相关文档:https://github.com/skylot/jadx
2、Bytecode-Viewer下载与使用方法
下载地址:https://github.com/konloch/bytecode-viewer/releases
通过上面地址下载指定的版本。
1) 通过命令运行图形版
java -jar Bytecode-Viewer-2.9.x.jar
文件名中版本根据实际版本进行修改。将jar,class或APK文件添加到工作区中。然后从工作区中选择要查看的文件。BCV将在后台自动开始反编译该类。完成后,它将显示您选择的类文件的源代码,字节码和十六进制代码(取决于您选择的 "view" 窗格)。如果您试图查看资源,则BCV将通过代码突出显示或嵌入资源本身来显示。
2) 直接通过命令行运行
以命令行运行,就是上面的命令后,在添加如下参数:
	-help                         Displays the help menu
	-list                         Displays the available decompilers
	-decompiler <decompiler>      Selects the decompiler, procyon by default
	-i <input file>               Selects the input file (Jar, Class, APK, ZIP, DEX all work automatically)
	-o <output file>              Selects the output file (Java or Java-Bytecode)
	-t <target classname>         Must either be the fully qualified classname or "all" to decompile all as zip
	-nowait                       Doesn't wait for the user to read the CLI messages相关文档:https://github.com/Konloch/bytecode-viewer
3、APK Studio下载与使用方法
下载地址:https://github.com/vaibhavpandeyvpz/apkstudio/releases
通过上面地址,下载对应系统的指定版本。
注意:确保JAVA_HOME环境变量指向有效的JDK,保证jadx能够运行。
1) 打开APK_Studio.exe
3) 填入参数
Project Name : 输入软件名
Apk Path : 输入APK路径,可选择,可拖动
Project Location : 工程保存地址,默认即可
Sign Apk Option : APK签名选项,共有3种方式,默认即可
Decompile Resources : 是否反编译资源文件, 如果不需要修改资源可不勾选
点击 "create" 完成就可以反编译。
4) 编译方法
点击 "Build" 即可完成编译
5) 查看JAVA代码方法
在APK文件上点击鼠标右键,选择 "View Java Code"
相关文档:Java Android(安卓)APK中Java代码查看方法(Apktool,dex2jar,jd-gui)