修改 classes.dex 并重新打包 .apk 文件

Modify classes.dex and repack .apk file

我想修改 Android 应用程序的 .apk 文件中的 classes.dex 文件并创建一个新的 .apk 文件。我已经知道如何使用 apktool 等工具反编译 .apk 文件,然后重新编译它。我的问题是准确修改 classes.dex 文件,而不是 .smali 代码。

我尝试使用修改后的 classes.dex 文件制作 .zip 存档并将其扩展名更改为 .apk,但我未能在我的 Android 小工具上安装此 .apk。

听起来您想在不将 classes.dex 文件反汇编为 smali 的情况下解码应用程序。在 Apktool 中,您可以使用 -s / --skip-sources 参数来避免这种情况。 Apktool 将简单地传递 classes.dex 而不是反汇编它。

那你随便怎么修改就可以了。然后使用 (apktool b) 重新编译,它会将 classes.dex 复制到最终构建的 apk 中。