http://hi.baidu.com/j_fo/blog/item/81ae650953ea5ec13ac76312.html
手動制作update.zip包的過程: 1.創建一個update目錄, 例如: update/ update/system update/system/app update/system/app/doodle_jump. update/META-INF update/META-INF/com update/META-INF/com/google update/META-INF/com/google/ update/META-INF/com/google/ 該目錄包含doodle_jump游戲, META-INF目錄下包含升級腳本,update-script腳本的內容如下: show_progress 0.500000 0 copy_dir PACKAGE:system SYSTEM: show_progress 0.100000 0 大家可以根據自己的升級內容添加相應的命令。 2.創建壓縮包 在update/目錄下運行: $ zip -qry ../update.unsigned.zip ./ 將在update/的父目錄下產生update. 3.簽名 $ java -Xmx512m -jar signapk.jar -w key.x509.pem key.pk8 update.unsigned.zip update.zip 生成簽過名的update.zip包,其中 signapk.jar,key.x509.pem, 4.將簽過名的update. 重啟系統進入recovery模式,選擇 apply update.zip,成功后重啟手機 ok,現在手機上已經有doodle_jump游戲了, refer: http://hi.baidu.com/j_fo/blog/item/53a45b82206837af0df4d21a.html How to Create Android Update Zip PackageThere are several ways to install applications or library files to an Android Phone. You can use Market application to find and install or adb command line tool to install or push the files to Android file system. These are all easy to implement for single file but if you have several applications or library files to install at once, it might be better to use update zip file. The update zip file is Android advanced system to install applications or lib files to Android file system using recovery tool. This method is commonly used by rom or theme developers to distribute their package. Creating an update zip file is quite easy, all you have to do is put the files in corresponding directory in Android file system and an update-script file to copy the files. For example, to install Calculator.apk into system/app and copy libsec-ril.so file into system/lib :
show_progress 0.1 0 Line 1&5 : show progress bar Note: you should add one extra line at the end of the file (Line 6) java -jar signapk.jar certificate.pem key.pk8 myupdate.zip update.zip Note: you can find tutorial on how to sign the update.zip file here update-script syntax reference (definitions from recovery.c android source code):
Syntax: copy_dir <src-dir> <dst-dir> [<timestamp>] Syntax: format <root> Syntax: delete <file1> [... <fileN>] Syntax: delete_recursive <file-or-dir1> [... <file-or-dirN>] Syntax: run_program <program-file> [<args> ...] Syntax: set_perm <uid> <gid> <mode> <path> [... <pathN>] Syntax: set_perm_recursive <uid> <gid> <dir-mode> <file-moe> <path> [... <pathN>] Ex: set_perm_recursive 0 0 0755 0644 SYSTEM:app Syntax: show_progress <fraction> <duration> Syntax: symlink <link-target> <link-path> Create a symlink (like ‘ln-s’). The <link-path> is in root:path format, but <link-target> is
----------文件位置:可以在platform/build/target/product/security/中找到platform.pk8 platform.x509.pem等簽名文件,對應不同的權限。 signapk.jar:由/platform/build/tools/signapk/編譯產出,可以在/out/host/linux-x86/framework/中找到。 簽名: java -jar signapk.jar platform.x509.pem platform.pk8 MyDemo.apk MyDemo_signed.apk 得到具有對應權限的APK 優化APK: zipalign -v 4 MyDemo_signed.apk MyDemo_new.apk 查循APK是否優化過: zipalign -c -v 4 MyDemo.apk |