title: APK injection, recompiling android manifest
body: <h2>What I'd like to achieve</h2>
  <p>Decompile <strong>AndroidManifest.xml</strong> packaged in apk from binary form into normal xml file, edit it and recompile it back into binary file acceptable for apk. Basically I need a driver for AXML files</p>
  <h2>Short background</h2>
  <p>I'm working on an APK injection project.
  My goal is</p>
  <ol>
  <li>Disassemble the dalvik binary</li>
  <li>Read AndroidManifest xml and add modifications to it, like change main activity and add permissions</li>
  <li>rebuild and sign the apk file</li>
  </ol>
  <p>I use apktool for assembling and disassembling the apk. However the apk tool works only with <code>--no-res</code> option, if apk is disassemled with resources it can not be built back. <a href="https://github.com/iBotPeaches/Apktool/issues/1734" rel="noreferrer">Here's a github issue describing this bug</a>.</p>
  <h2>The problem</h2>
  <p>Since I disassemle the <code>apktool d --no-res app-debug.apk</code> with no res flag the Generated android manifest comes in binary form. I can disassemble the manifest using <code>apktool</code> but I can not assemnle it back.</p>
  <h1>What I want to be able to do</h1>
  <p>I need to either:</p>
  <ul>
  <li>Find a way to disassemble the manifest and then assemble it back into binary form</li>
  <li>Find a way to use <code>apktool</code> with resources</li>
  </ul>
  <h1>What I have tried so far</h1>
  <ul>
  <li>Replacing the binary <code>AndroidManifest.xml</code> with plain-text version and then build. The <code>apktool</code> would build. However the installation of the app to device fails with &quot;Parse error there is a problem while parsing the package&quot;.</li>
  <li>Using different versions of <code>apktool</code> : <code>v2.3.2</code>, <code>v2.3.1</code>, <code>v2.3.0</code>, <code>v2.2.0</code>, <code>v2.2.1</code>, <code>v2.2.2</code></li>
  <li>Compiling axml using following projects: <a href="https://github.com/rednaga/axmlprinter" rel="noreferrer">https://github.com/rednaga/axmlprinter</a> ; <a href="https://github.com/ZaratustraN/axml-parser" rel="noreferrer">https://github.com/ZaratustraN/axml-parser</a> ; <a href="https://github.com/shazam/axmlparser" rel="noreferrer">https://github.com/shazam/axmlparser</a></li>
  </ul>
  <h2>Disclaimer</h2>
  <p>Although stackoverflow is a community for knowledge sharing, and not judging what it's used for - I see a lot of people picking on others in similar questions with accusations for illegal activities.</p>
  <p>What I'm doing is absolutely legal and will not be used to exploit anyone.</p>