Overview:
This thread is a guide on how to fix the apply_patch_check error message experienced during an upgrade of the Android OS. Specifically, this will detail the steps for an upgrade of Jelly Bean from 4.1.1 to 4.1.2 on the Nexus 7 with CWM Recovery for a user of Windows. I'm sure similar steps will work for other recoveries/upgrades/devices and PC OSes.
You should only bother with this if you don't want to flash the entire system.img file to your phone, which is way easier.
Here is an example of the error message I'm talking about:
A few notes about the error:
Cause of the problem:
The reason this error occurs is because the file was somehow modified from its original state. In my case -- and most likely your case -- this was done by Titanium Backup. TB has an option to "Integrate updates of system apps into ROM", which will cause the apk in /system/app (and associated library files in /system/lib, if needed) to be overwritten with the updated apk.
Solution:
* Future updates (above 4.1.2):
Since I won't be keeping the zip file from step #1 up-to-date, here's how to get the directories that I included in the zip for yourself:
** How to avoid repeating steps:
If you'd rather not have to try to reinstall after updating only one file, just to find another file that needs updating, try this:
Summary:
I hope that this post helped some of you who really didn't want to have to flash the system.img or wipe your device just to update. In the future, use TB to back up the original.
I wouldn't normally bother writing up a guide like this (it took almost as long to write as it did to figure out how to do this) but I couldn't find this solution anywhere even though I saw that I wasn't the only person with the problem. Sorry for not posting this guide sooner (update has been out for a while now), but the forum required me to make a bunch of useless spam posts before I could include any links in my guide and I didn't get around to making those posts right away.
*** I would like to thank balamu96m for his guide on extracting data from the system.img file and drphrozen for making the sgs2toext4 program.
This thread is a guide on how to fix the apply_patch_check error message experienced during an upgrade of the Android OS. Specifically, this will detail the steps for an upgrade of Jelly Bean from 4.1.1 to 4.1.2 on the Nexus 7 with CWM Recovery for a user of Windows. I'm sure similar steps will work for other recoveries/upgrades/devices and PC OSes.
You should only bother with this if you don't want to flash the entire system.img file to your phone, which is way easier.
Here is an example of the error message I'm talking about:
Code:
assert failed: apply_patch_check("/system/app/Chrome.apk", "819b34b66335c6faec86404d736a002b8871600", "9d6b55e63b0bf20bea433fb1ee7089f88ab73fb6")
E: Error in /sdcard/03a4eaf95f73.signed-nakasi-JZO54K-from-JRO03D.03a4eaf9.zip
(Status 7)
Installation aborted.
- This doesn't have to happen with the Chrome.apk specifically -- it could happen with any app in /system/app or .so in /system/lib.
- Those random strings of numbers/letters are SHA-1 hashes of the apk.
- The first one is the hash of the apk installed on your device. In my example, this happens to be the version of Chrome that comes with JB 4.1.2.
- The second one is the expected hash of the apk that comes with JB 4.1.1.
Cause of the problem:
The reason this error occurs is because the file was somehow modified from its original state. In my case -- and most likely your case -- this was done by Titanium Backup. TB has an option to "Integrate updates of system apps into ROM", which will cause the apk in /system/app (and associated library files in /system/lib, if needed) to be overwritten with the updated apk.
Solution:
- Download this zip file which contains the full /system/app and /system/lib directory from the JB 4.1.1 factory image. *
- Extract the zip to a location of your choosing on your PC.
- In the extracted folder, locate the .apk or .so file referenced in the error message on your device.
- Copy this file to your device via your preferred method (USB cable works fine). I put my file in /sdcard/Download.
- On your device, use a root file explorer to move the file from /sdcard/Download to /system/app (or /system/lib).
- If you don't have a program that can do this, I use ES File Explorer. Be sure to go to Settings > Root Settings and turn on Root Explorer, Up to Root, and Mount File System.
- Reboot into your Recovery and try to install the update again.
- Repeat steps 3-6 for each subsequent file that produces an error. You will basically need to do this for each app you integrated using TB and maybe a few library files, too. **
* Future updates (above 4.1.2):
Since I won't be keeping the zip file from step #1 up-to-date, here's how to get the directories that I included in the zip for yourself:
- Obtain a factory image for your device's current Android version (the version you're updating from).
- For JB 4.1.1, this file is called nakasi-jro03d-factory-e102ba72.tgz.
- If you're reading this guide at a later date, the JB 4.1.2 file is called nakasi-jzo54k-factory-973f190e.tgz.
- You can try your luck at the official Google site, but they seem to only provide the version you're trying to update to, not from.
- Extract the .tgz file somewhere on your PC.
- Locate the image-naksi-jro03d.zip file and extract that, as well.
- In the folder you just extracted from the previous step, located the system.img file.
- Download and use a program called sgs2toext4 (View attachment 645320) to convert the system.img to system.ext4.img. ***
- Download and use a program called Linux Reader to open system.ext4.img.
- Do this by going to Drives > Mount Image > Next > select your file.
- It will then be listed under the Hard Disk Drives section in red as "Linux Ext Volume 1".
- Navigate to: Linux Ext Volume 1/system.
- Right-click on the app (or lib) directory and pick Save > Next > Output to dir of your choice.
- You now have the directories that were included with the zip file from Solution step #1, so just follow those steps now.
** How to avoid repeating steps:
If you'd rather not have to try to reinstall after updating only one file, just to find another file that needs updating, try this:
- Obtain the /system/app and /system/lib folders from the factory image and save them to your PC.
- For the sake of this guide, let's say you save them to C:\factory_app and C:\factory_lib.
- Copy the /system/app and /system/lib directories from your phone to your PC.
- For the sake of this guide, let's say you saved them to C:\phone_app and C:\phone_lib.
- Download the File Checksum Integrity Verifier utility from Microsoft.
- Start > Run > cmd
- fciv.exe -sha1 -xml factory_app.xml -wp C:\factory_app
- fciv.exe -sha1 -xml factory_app.xml -v -bp C:\phone_app
- Don't ask me why, but you need to use -bp instead of -wp for the second command.
- Don't forget the -v on the second command.
- The output of the last command will show you the list of files that are different. These are the files you need to take from C:\factory_app and put into the /system/app directory on your phone.
- Do the same for the lib directories (just replace all instances of "_app" with "_lib" in the previous commands).
Summary:
I hope that this post helped some of you who really didn't want to have to flash the system.img or wipe your device just to update. In the future, use TB to back up the original.
I wouldn't normally bother writing up a guide like this (it took almost as long to write as it did to figure out how to do this) but I couldn't find this solution anywhere even though I saw that I wasn't the only person with the problem. Sorry for not posting this guide sooner (update has been out for a while now), but the forum required me to make a bunch of useless spam posts before I could include any links in my guide and I didn't get around to making those posts right away.
*** I would like to thank balamu96m for his guide on extracting data from the system.img file and drphrozen for making the sgs2toext4 program.
Last edited: