在 APK 中编码/解码 AndroidManifest.xml [英] Encode/Decode AndroidManifest.xml inside APK

查看:203
本文介绍了在 APK 中编码/解码 AndroidManifest.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ApkTool 来解码 AndroidManifest.xmlAPK 文件,它可以完美运行,但如何在应用一些更改后再次对其进行编码,与之前编码的方式相同?例如(就我而言)更改应用标签.

I'm using ApkTool to decode AndroidManifest.xml inside an APK file and it works perfectly but how can I encode it again ,the same way it was encoded before, after applying some changes? For example (in my case) changing the app label.

推荐答案

您可以再次使用 apktool 创建一个新的 APK 文件,其中包含您更改的 AndroidManifest.xml.

You may use apktool again to create a new APK file including your changed AndroidManifest.xml.

首先反编译APK文件:

First, decompile the APK file:

java -jar apktool.jar decode app.apk app

然后在app目录下修改你想要的文件,重新编译回新的APK:

Then modify the files you want in the app directory and recompile it back into a new APK:

java -jar apktool.jar build app app_new.apk

aapt 必须在我们的 PATH 上,或者使用 --aapt 选项来指定可执行文件的位置.否则 apktool 在重建 APK 时会失败.

aapt must be on our PATH or use the --aapt option to specify the location of the executable. Otherwise apktool will fail when rebuilding the APK.

注意:重建的 APK 既没有签名也没有zipaligned,只是重新打包了.请查看本网站,了解有关签署和对齐您的新的 APK.

Note: The rebuilt APK is neither signed nor zipaligned, just repackaged. Take a look at this website for details about signing and aligning your new APK.

这篇关于在 APK 中编码/解码 AndroidManifest.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆