婆婆来了刘小雅重生:Android 制作 升级包
来源:百度文库 编辑:中财网 时间:2024/07/11 06:31:38
http://hi.baidu.com/j_fo/blog/item/81ae650953ea5ec13ac76312.html
http://hi.baidu.com/j_fo/blog/item/53a45b82206837af0df4d21a.html
如何制作自己的android升级包(update.zip) 2010-09-04 19:34 手动制作update.zip包的过程:
1.创建一个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 Package
There 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 :
- Create an empty folder (eg. C:\myupdate)
- Create C:\myupdate\system\app folder for Calculator.apk and C:\myupdate\system\lib folder for libsec-ril.so
- Create C:\myupdate\META-INF\com\google\android folder for update-script file.
- Create the update-script file with the following syntax:
show_progress 0.1 0
copy_dir PACKAGE:system SYSTEM:
show_progress 0.1 10
Line 1&5 : show progress bar
Line 3: copy system folder from update package to Android’s /system
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):
- copy_dir
- format
- delete
- delete_recursive
- run_program
- set_perm
- set_perm_recursive
- show_progress
- symlink
Syntax: copy_dir
Copy the contents of
Ex: copy_dir PACKAGE:system SYSTEM:
Syntax: format
Format a partiti0n
Ex: format SYSTEM:, will format entire /system . Note: formatting erases data irreversibly.
Syntax: delete
Delete file.
EX: delete SYSTEM:app/Calculator.apk, will delete Calculator.apk from system/app directory.
Syntax: delete_recursive
Delete a file or directory with all of it’s contents recursively
Ex: delete_recursive DATA:dalvik-cache, will delete /data/dalvik-cache directory with all of it’s contents
Syntax: run_program
Run an external program included in the update package.
Ex: run_program PACKAGE:install_busybox.sh, will run install_busybox.sh script (shell command) included in the update package.
Syntax: set_perm
Set ownership and permission of single file or entire directory trees, like ‘chmod’, ‘chown’, and ‘chgrp’ all in one
Ex: set_perm 0 2000 0550 SYSTEM:etc/init.goldfish.sh
Syntax: set_perm_recursive
Set ownership and permission of a directory with all of it’s contents recursively
Ex: set_perm_recursive 0 0 0755 0644 SYSTEM:app
Syntax: show_progress
Use of the on-screen progress meter for the next operation, automatically advancing the meter over
Ex: show_progress 0.1 0
Syntax: symlink
Create a symlink (like ‘ln-s’). The
for the target filesystem (and may be relative)
----------
用Android自带的signapk.jar + .x509.pem + .pk8签名应用程序
http://lmdy2001.blog.163.com/blog/static/8423891020114262323816/
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