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

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

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
经验分享 程序员 微信小程序 职场和发展