Thursday, October 10, 2013

Creating an Android Update.zip Package

Installing applications to an Android phone is simple, either use the Market application to find and install,  put the apk file for the program on to your phone/SD card and install using Astro or finally you can use the adb push command to push the files to the phone. These are all fine methods of installing single programs to the phone but when you want to install a few programs/libraries/configs all at once you may be better using an Update.zip file with everything packaged up. The case for such a file is obvious when you want to add all of the Google applications to the AOSP builds of Android which would take a while rather than installing one update.


Information on how to create the Update.zip was taken from htcpedia.com thanks to Lox for sharing.

Creating an update.zip package is quite easy in fact. For example, to add a (valid) test.apk package to your rom:

- create an empty folder <workdir>
- create folder structure for test.apk (<workdir>/system/app) and copy the test.apk
- create folder structure for update-script (<workdir>/META-INF/com/google/android)
- edit <workdir>/META-INF/com/google/android/update-script
- put in it:

show_progress 0.1 0
 
copy_dir PACKAGE:system SYSTEM:
set_perm_recursive 0 0 0755 0644 SYSTEM:app
show_progress 0.1 10
- compress the <workdir> content to zip (not the <workdir> folder itself)

Now you are going to sign the zip file. Download testsign.zip and copy it in your <SDK>/tools folder. Extract it here. It should create a sign subfolder with a testsign.jar file in it.

Then in the command prompt/terminal, from <workdir> folder, do:
java -classpath <SDK>/tools/sign/testsign.jar" testsign file.zip file-signed.zip
Ok, now your zip file is ready to be deployed using the “Flash zip from sdcard” option in a recovery image.

0 comments:

Post a Comment