从 apk 中读取 res 文件夹

发布于 2024-12-22 09:48:51 字数 603 浏览 3 评论 0原文

我想读取 res 文件夹中的所有 xml 文件。 我能够使用 jar AXMLPrinter2.jar 读取清单文件 同样,我尝试读取 res 文件夹中的 xml 文件,如下所示,

java -jar 'AXMLPrinter2.jar' 'account_list_item.xml' >'account_list_item.txt' 

但它显示了一些异常,如下所示,

java.lang.ArrayIndexOutOfBoundsException: 109
    at android.content.res.StringBlock.getShort(StringBlock.java:231)
    at android.content.res.StringBlock.getString(StringBlock.java:91)
    at android.content.res.AXmlResourceParser.getName(AXmlResourceParser.java:140)
    at test.AXMLPrinter.main(AXMLPrinter.java:56)

有什么办法吗?

I want to read all the xml files in res folder.
I able to read Manifest file using jar AXMLPrinter2.jar
Same way i am trying to read xml files in res folder like below,

java -jar 'AXMLPrinter2.jar' 'account_list_item.xml' >'account_list_item.txt' 

but it shows some exception like bellow,

java.lang.ArrayIndexOutOfBoundsException: 109
    at android.content.res.StringBlock.getShort(StringBlock.java:231)
    at android.content.res.StringBlock.getString(StringBlock.java:91)
    at android.content.res.AXmlResourceParser.getName(AXmlResourceParser.java:140)
    at test.AXMLPrinter.main(AXMLPrinter.java:56)

Is there any way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏九 2024-12-29 09:48:51

我认为 AXMLPrinter2.jar 需要您首先从 APK 中提取 XML 文件。您可以使用 apktool 来完成此操作,它已经将文件转换为人类可读的形式。

像这样使用:

apktool decode --no-src yourapk.apk

I think AXMLPrinter2.jar needs that you first extract the XML files from the APK. You can do that with apktool, which already transforms the files into a human-readable form.

Use like this:

apktool decode --no-src yourapk.apk
陈独秀 2024-12-29 09:48:51

根据这个
如果 apk 的 minSdkVersion >= 7,则不起作用

更新:
找到了这个

according to this and this
if apk's minSdkVersion >= 7, it didn't work

UPDATE:
found this

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文