Giter Site home page Giter Site logo

xml2axml's Introduction

xml2axml

Encode xml to axml OR decode xml from axml

  • encode
java -jar xml2axml e [AndroidManifest-readable-in.xml] [AndroidManifest-bin-out.xml]
  • decode
java -jar xml2axml d [AndroidManifest-bin-in.xml] [AndroidManifest-readable-out.xml]

Note
The project is based on This project

xml2axml's People

Contributors

hzw1199 avatar l741589 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

xml2axml's Issues

[Bug]Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION

adb 安装重新签名后的apk后报错

adb: failed to install new.apk: Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION: Failed to parse /data/app/vmdl592381158.tmp/base.apk: AndroidManifest.xml]

我的使用顺序如下:
unzip -d ./old old.apk

java -jar xml2axml-1.1.0.jar d AndroidManifest.xml AndroidManifest-out.xml

修改AndroidManifest-out.xml中的一个meta-data的value
java -jar xml2axml-1.1.0.jar e AndroidManifest-out.xml AndroidManifest.xml

返回上级目录
zip -q -r new.apk ./old

重新签名
apksigner sign --ks key.jks --min-sdk-version 21 new.apk

安装new.apk后报错
我感觉重新签名的步骤也没什么问题,所以是不是有可能是处理 AndroidManifest.xml 的时候?

[Bug] java.lang.ArrayIndexOutOfBoundsException at decode

For some AndroidManifest.xml files decoding fails and java.lang.ArrayIndexOutOfBoundsException is thrown.

java.lang.ArrayIndexOutOfBoundsException: 2325
        at android.content.res.StringBlock.getShort(StringBlock.java:231)
        at android.content.res.StringBlock.getString(StringBlock.java:91)
        at android.content.res.AXmlResourceParser.getNamespaceUri(AXmlResourceParser.java:186)
        at com.bigzhao.xml2axml.test.AXMLPrinter.decode(AXMLPrinter.java:84)
        at com.bigzhao.xml2axml.test.AXMLPrinter.main(AXMLPrinter.java:47)
        at com.bigzhao.xml2axml.test.Main.decode(Main.java:37)
        at com.bigzhao.xml2axml.test.Main.main(Main.java:21)

To reproduce try to decode the following binary AndroidManifest.xml files extracted from old mozilla fennec nightly build APKs.

java -jar xml2axml d AndroidManifest---2018-07-25--10-30-32.xml.txt AndroidManifest-readable.xml

AndroidManifest---2018-07-25--10-30-32.xml.txt
AndroidManifest---2018-07-26--10-03-40.xml.txt

The the first Manifest fails but the second one works.

[Bug] Empty String causes INSTALL_PARSE_FAILED

Thank you for providing this nice tool, covering many use-cases that require AndroidManifest modification.

The following procedure (simple test) should work with every APK.
However it causes a Parse Error on installation with some APKs.

(0.  try to install the original apk on android device)
(1.) extract AndroidManifest.xml: unzip my.apk AndroidManifest.xml -d ./old/
(2.) decode via java -jar xml2axml.jar d ./old/AndroidManifest.xml _readable.xml
(3.) do NOT change anything in _readable.xml
(4.) encode via java -jar xml2axml.jar e _readable.xml AndroidManifest.xml
(5.) update the AndroidManifest-File: zip my.apk AndroidManifest.xml
(6.) resign apk with jarsigner or apksigner
(7.) try to install the "new" apk on android device.

For example with APKs of the Browser Firefox-for-Android (Fennec) the last step fails.
(Parse Error : There is a problem parsing the package occurs immediately after tapping the apk-file on device to install.)

So I've done some basic research and found that empty attribute-value strings causing this problem (when using xml2axml.jar e).

It's most easy to reproduce with the first version of Fennec (apk) that has only a tiny AndroidManifest (source  ~>  mozilla-central/embedding/android/AndroidManifest.xml.in).

Commenting out the element <data android:scheme="" ></data> in _readable.xml prevents the occurrence of this error.

Hope someone could fix this problem with empty string handling at encoding.

Exception in thread "main" java.lang.NumberFormatException:

Hi , the .jar wouldn't run unless I put it as

java -jar xml2axml.jar e output.xml output2.xml

And then it spat out this for the Kiwi Browser AndroidManifest XML:

Exception in thread "main" java.lang.NumberFormatException: For input string: "4294966796"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at com.bigzhao.xml2axml.chunks.ValueChunk.evaluate(ValueChunk.java:163)
        at com.bigzhao.xml2axml.chunks.ValueChunk.preWrite(ValueChunk.java:66)
        at com.bigzhao.xml2axml.chunks.Chunk.calc(Chunk.java:116)
        at com.bigzhao.xml2axml.chunks.AttrChunk.preWrite(AttrChunk.java:36)
        at com.bigzhao.xml2axml.chunks.Chunk.calc(Chunk.java:116)
        at com.bigzhao.xml2axml.chunks.StartTagChunk.preWrite(StartTagChunk.java:75)
        at com.bigzhao.xml2axml.chunks.Chunk.calc(Chunk.java:116)
        at com.bigzhao.xml2axml.chunks.TagChunk.preWrite(TagChunk.java:46)
        at com.bigzhao.xml2axml.chunks.Chunk.calc(Chunk.java:116)
        at com.bigzhao.xml2axml.chunks.TagChunk.preWrite(TagChunk.java:48)
        at com.bigzhao.xml2axml.chunks.Chunk.calc(Chunk.java:116)
        at com.bigzhao.xml2axml.chunks.TagChunk.preWrite(TagChunk.java:48)
        at com.bigzhao.xml2axml.chunks.Chunk.calc(Chunk.java:116)
        at com.bigzhao.xml2axml.chunks.TagChunk.preWrite(TagChunk.java:48)
        at com.bigzhao.xml2axml.chunks.Chunk.calc(Chunk.java:116)
        at com.bigzhao.xml2axml.chunks.XmlChunk.preWrite(XmlChunk.java:40)
        at com.bigzhao.xml2axml.chunks.Chunk.calc(Chunk.java:116)
        at com.bigzhao.xml2axml.chunks.Chunk.write(Chunk.java:98)
        at com.bigzhao.xml2axml.Encoder.encode(Encoder.java:83)
        at com.bigzhao.xml2axml.Encoder.encodeFile(Encoder.java:31)
        at com.bigzhao.xml2axml.test.Main.encode(Main.java:31)
        at com.bigzhao.xml2axml.test.Main.main(Main.java:19)

unable to access jarfile xml2axml

I get the error mentioned in the title. Any ideas ?
I have downloaded the latest release and unpacked all the contents. There is no JAR_file in the folder tho...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.