Skip to content

Instantly share code, notes, and snippets.

@raek
Created November 11, 2012 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raek/4056327 to your computer and use it in GitHub Desktop.
Save raek/4056327 to your computer and use it in GitHub Desktop.
private static void zipDex(File dexFile, File zippedDexFile) throws IOException
{
InputStream in = new FileInputStream(dexFile);
OutputStream out = new FileOutputStream(zippedDexFile);
ZipOutputStream zipOut = new ZipOutputStream(new BufferedOutputStream(out));
ZipEntry classesEntry = new ZipEntry("classes.dex");
zipOut.putNextEntry(classesEntry);
byte[] buffer = new byte[1024];
while (true) {
int read = in.read(buffer);
if (read == -1) break;
zipOut.write(buffer, 0, read);
}
in.close();
zipOut.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment