TOOLS & PREPARE
- apktool ( Download in github )
- dex2jar ( Download in github )
- jd-gui ( Download in github )
下载好三个工具
将 下载apktool_版本号.jar 改为 apktool.jar, 在 apktool 目录下新建 apktool.bat
内容如下(可参考https://ibotpeaches.github.io/Apktool/install/)
@echo off
setlocal
set BASENAME=apktool_
chcp 65001 2>nul >nul
set java_exe=java.exe
if defined JAVA_HOME (
set java_exe="%JAVA_HOME%\bin\java.exe"
)
rem Find the highest version .jar available in the same directory as the script
setlocal EnableDelayedExpansion
pushd "%~dp0"
if exist apktool.jar (
set BASENAME=apktool
goto skipversioned
)
set max=0
for /f "tokens=1* delims=-_.0" %%A in ('dir /b /a-d %BASENAME%*.jar') do if %%~B gtr !max! set max=%%~nB
:skipversioned
popd
setlocal DisableDelayedExpansion
rem Find out if the commandline is a parameterless .jar or directory, for fast unpack/repack
if "%~1"=="" goto load
if not "%~2"=="" goto load
set ATTR=%~a1
if "%ATTR:~0,1%"=="d" (
rem Directory, rebuild
set fastCommand=b
)
if "%ATTR:~0,1%"=="-" if "%~x1"==".apk" (
rem APK file, unpack
set fastCommand=d
)
:load
%java_exe% -jar -Duser.language=en -Dfile.encoding=UTF8 "%~dp0%BASENAME%%max%.jar" %fastCommand% %*
rem Pause when ran non interactively
for /f "tokens=2" %%# in ("%cmdcmdline%") do if /i "%%#" equ "/c" pause
如下效果
STEPS
1st
./apktool d F:\myJavaCode\_Android\ReverseEngineering\base.apk -o F:\myJavaCode\_Android\ReverseEngineering\base -s
2nd
转化 1st 中的 classes.dex 为 jar
./d2j-dex2jar.bat F:\myJavaCode\_Android\ReverseEngineering\base\classes.dex
3rd
启动 jd-gui, 打开 jar包, 查看 java 源码
java -jar .\jd-gui-1.6.6.jar