java 读取apk,从APK读取资源文件夹

尝试使用AXMLPrinter2.jar读取APK资源文件夹中的XML文件时遇到ArrayIndexOutOfBoundsException异常。解决方案是先用apktool解压XML文件,apktool能将XML转换成可读格式。使用命令行工具apktool进行解码操作:apktool decode --no-src yourapk.apk。
摘要由CSDN通过智能技术生成

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?

解决方案

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值