16 Oct 2011

Sign an "unsigned" file in Android

Recently i came up with Titanium backup pro. Its such a wonderful took to take backup of your applications along with the data and settings.

You can even remove apps which were preinstalled with the phone, freeze it or take backup. There is a feature in Titanium backup where you can create an update.zip so that you can directly install Titanium from recovery mode (this helps a lot of time installing every application you flash the ROM).

However what Titanium backup creates is an "unsigned" file. Basically every APK files are to be signed so that the OS can validate if its from a valid creator or not. Since the file is not signed the installation from recovery mode will fail. I have just ran through a tutorial to sign the file. Follow the steps below

Disclaimer: I am not responsible if you brick your phone.Please test at your own risk and expense

Application Please note that this is applicable only if you are flashing a ROM and you need to delete all data using factory reset and start from scratch.

1) Ensure that you have taken backup of all the current applications using Titanium backup
2) Take backup of the following files/folders on your laptop
- TitaniumBackup (include backups of all apps and data)
- Other important files (music, personal records etc)
3) Create an update.zip file on /mnt/sdcard using TitaniumBackup
4) Plug the phone onto laptop and copy the update.zip on the laptop, remove the connection
5) Ensure that you have Android SDK installed on your laptop
6) Set the correct classpath in the environment variable
- Right click on My computer> Properties> Advanced system settings> Environment variables
- Select Tem, and under System variables select CLASSPATH
- Add semi-colon and C:\program files\Android\android-sdk\ after the end ie ;C:\program files\Android\android-sdk\

Signing the update.zip
1) Download testsign.zip and copy it in your /tools folder. Extract it here. It should create a sign subfolder with a testsign.jar file in it.
2) Go to command promt (Windows button+R, then type cmd and enter)
3) Go to the path where you have the copy of update.zip file in command mode
4) Type the following command
java -classpath /tools/sign/testsign.jar" testsign update.zip update-signed.zip
5) Once done, you will see a new file on the path update-signed.zip
Thats it, you have signed the file. Now you can go and flash your new ROM. Post installation, when you need to install the older apps go through the below steps
1) Reboot into recovery mode. 
2) Select the option Install from sdcard
3) Select update-signed.zip
4) Select reboot the system
5) Once phone is up, connect it to laptop and copy all the data (step 2 of prequisites list above) back to SDCARD
6) Disconnect the phone from the laptop
7) Open TitaniumBackup (installed in sept 3 above)
8) Ensure that the phone is rooted. Restore all application backups
Bingo !! you will be up and running in a matter of minutes..
Do let me know in case you have any issues

Credits: RobMcGhee.com

Update: You can install unsigned zip files in recovery mode. Read here.


comments powered by Disqus