apktool_2.6.0.jar 改成apktool.jar 和apktool.bat放在同一个文件夹,并将此文件夹加入系统变量Path(D:\SoftWare\apktool)
apktool.bat:
@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
C:\Users\Administrator>apktool d D:\SoftWare\apktool\xb.apk -o D:\SoftWare\apktool\baz2 I: Using Apktool 2.6.0 on xb.apk I: Loading resource table... I: Decoding AndroidManifest.xml with resources... I: Loading resource table from file: C:\Users\Administrator\AppData\Local\apktool\framework\1.apk I: Regular manifest package... I: Decoding file-resources... I: Decoding values */* XMLs... I: Baksmaling classes.dex... I: Copying assets and libs... I: Copying unknown files... I: Copying original files... I: Copying META-INF/services directory C:\Users\Administrator>
https://ibotpeaches.github.io/Apktool/install/ https://ibotpeaches.github.io/Apktool/#
Apktool 下载、安装和使用
Apktool
简介
- 用于反编译Android apk,可以将应用中的资源提取出来,也可以在修改资源文件后重新打包。
- smali 调试
环境要求
- 安装java 1.8 以上
- 命令行运行 java -version 返回版本大于1.8
- 如果没有,请安装java 1.8
下载与安装
-
重命名下载的apktool_x.x.x.jar,改名为apktool.jar
-
下载脚本并配置
-
命令行中输入 apktool 验证
使用
- 反编译
使用 d 或者 decode 命令
$ apktool d bar.apk
$ apktool decode bar.apk
// 效果一样 反编译 bar.apk 并将其解压到 bar 目录
$ apktool d bar.apk o baz
反编译 bar.apk 并将其解压到 baz 目录
- 重新打包
使用 b 或 build
$ apktool b bar -o new_bar.apk
// 将 bar 目录的资源打包成 new_bar.apk
重新打包生成的 apk 需要签名才能安装
参考
https://www.jianshu.com/p/919a966843c4
##############################################################################################################
Install Instructions
Quick Check
- Is at least Java 1.8 installed?
- Does executing java -version on command line / command prompt return 1.8 or greater?
- If not, please install Java 8+ and make it the default. (Java 7 will also work at this time)
Installation for Apktool
- Windows:
- Download Windows wrapper script (Right click, Save Link As
apktool.bat
) - Download apktool-2 (find newest here)
- Rename downloaded jar to
apktool.jar
- Move both files (
apktool.jar
&apktool.bat
) to your Windows directory (UsuallyC://Windows
) - If you do not have access to
C://Windows
, you may place the two files anywhere then add that directory to your Environment Variables System PATH variable. - Try running apktool via command prompt
- Download Windows wrapper script (Right click, Save Link As
- Linux:
- Download Linux wrapper script (Right click, Save Link As
apktool
) - Download apktool-2 (find newest here)
- Rename downloaded jar to
apktool.jar
- Move both files (
apktool.jar
&apktool
) to/usr/local/bin
(root needed) - Make sure both files are executable (
chmod +x
) - Try running apktool via cli
- Download Linux wrapper script (Right click, Save Link As
- macOS:
- Download Mac wrapper script (Right click, Save Link As
apktool
) - Download apktool-2 (find newest here)
- Rename downloaded jar to
apktool.jar
- Move both files (
apktool.jar
&apktool
) to/usr/local/bin
(root needed) - Make sure both files are executable (
chmod +x
) - Try running apktool via cli
Or you can install apktool via Homebrew:
- Install Homebrew as described in this page
- Execute command
brew install apktool
in terminal (no root needed). The latest version will be installed in/usr/local/Cellar/apktool/[version]/
and linked to/usr/local/bin/apktool
. - Try running apktool via cli
- Download Mac wrapper script (Right click, Save Link As
Note - Wrapper scripts are not needed, but helpful so you don’t have to type java -jar apktool.jar over and over.
https://ibotpeaches.github.io/Apktool/install/