note/tech/apk反编译.md
2025-11-19 10:16:05 +08:00

35 lines
1.1 KiB
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# APK反编译并重新签名
> 对于APK没有源代码但是需要修改部分资源内容的可以解包后修改并重新打包、签名再安装。
## 使用的工具
1. apktool apktool.jar
在apktool官方网站 https://apktool.org 下载最新版本的脚本和jar包脚本自己设置可执行`chmod +x apktool`,jar包改名把版本号去掉改为`apktool.jar`,放在同一个目录里
2. 需安装jdk8以上不解释自己装
3. signapk.jar网上搜一下吧
4. 证书platform.x509.pem platform.pk8android源码包里有。网上搜一下也可以下载
## 解包
```
./apktool d old.apk
```
解压缩一个同名的文件夹old
## 修改资源文件
在文件夹里自己修改内容
## 打包
```
./apktool b old
```
在old文件夹的dist里面找会生成一个未签名的apk我们可以重命名为`old_unsigned.apk`
## 签名
1. 把signapk.jar platform.pk8 platform.x509.pem和old_unsigned.apk放在同一个目录
2. 执行
```shell
java -jar signapk.jar \
platform.x509.pem platform.pk8\
old_unsigned.apk new_signed.apk
```
new_signed.apk是新的已经签名的包。