title: How to rebuild apk after modifying/instrumenting its bytecode?
body: <p>I need to instrument the dalvik bytecode of any given .apk file as part of my research and to obtain working, modified .apk with the instrumented bytecode. </p>
  
  <p>I am programming in Java 1.6 under Windows 7.</p>
  
  <p><strong>Input</strong></p>
  
  <ul>
  <li>The original .apk file with the original, unchanged <code>classes.dex</code> dalvik bytecode.</li>
  <li>the instrumented <code>classes.dex</code> bytecode of the .apk (yes, we assume we already instrumented the bytecode).</li>
  </ul>
  
  <p><strong>Desired output</strong></p>
  
  <ul>
  <li>The .apk file with the instrumented <code>classes.dex</code> bytecode instead of the original.</li>
  </ul>
  
  <p><strong>Problem statement</strong></p>
  
  <p>What is the most straightforward way to obtain the desired output from Java source code? </p>