I have a sprint samsung galaxy s5 (g900P) I am a mac user without access to a PC (no odin). I have TWRP recovery installed. I am currently running lineage OS (nougat) I need to return to stock (the reason for this is that I am trying to activate new cellular service and it doesn't seem to work under lineage. If someone has experience activating TPO or other cell service using lineage or updating PRL on non-stock firmware please let me know since that might obviate these other problems).

I used android file transfer to move the stock firmware zip in the download section to the internal SD (root folder). I wiped the system and cache, then install zip - but it fails every time with "invalid zip file format". I have tried a half dozen other versions of the stock ROM from various sources and they all fail with the same error. ZIP signature verification is disabled. Just when I thought that i was doing something completely dumb and not flashing correctly at all - I tried re-flashing the lineageOS ROM i have and that worked fine. I've read a bit about unpacking and re-zipping these zips to get them to work, but that requires 7zip (which I don't have on mac). Help! am I doing something dumb or do I not have the correct zip files?

I saw this thread that had a partial answer but I am not a developer so it was way over my head. not sure I know how to proceed: (SOLVED - partial) Flashing Source Built ROM Fails in TWRP, Invalid File Format Do i need to modify the zip files I have? can someone link me to a zip for the stock firmware that will work on TWRP? for the record I grabbed the 3CQA2 zip from here: https://www.mediafire.com/folder/brujjvaro2ogo/Odin_images which I grabbed from this thread https://forum.xda-developers.com/sprint-galaxy-s5/development/firmware-sprint-s5-factory-odin-images-t3585129


  • Why TWRP? Why not straight-up Odin?
    – Andy Yan
    May 28, 2017 at 15:32
  • 1
    Most factory images from manufacturers can't be flashed in TWRP, you would need to use fastboot, ODIN, LG FLash, Smart Tool, or other manufacturer specific tool. Most ZIP files of stock firmware are not in the correct format for TWRP. If you want to return to stock from a custom ROM and do not have the TWRP backup, you need to use the manufacturers recommended method.
    – acejavelin
    May 28, 2017 at 15:54
  • I can't use Odin because I only have a mac. There's a mac port of Odin called Heimdall - but it isn't able to work on sierra. What could I use instead?
    – user222038
    May 28, 2017 at 23:32
  • Just borrow a Windows PC. Odin only requires a piece of Samsung driver to work properly.
    – Andy Yan
    May 29, 2017 at 0:26
  • confirmed that this worked. For the sake of future googlers: I borrowed a windows PC, installed samsung drivers, installed odin, downloaded the ROM, unpacked it, pointed Odin to it and flashed. Right now I'm stuck in a bootloop, but that could be a ROM version issue. Odin worked as expected and flashed the ROM
    – user222038
    May 29, 2017 at 1:33

1 Answer 1


I encountered this too:

build/tools/releasetools/sign_target_files_apks -o -d "$KEY_DIR" out/target/product/$DEVICE/obj/PACKAGING/target_files_intermediates/aosp_$DEVICE-target_files-eng.xx.zip $OUT/$TARGET_FILES

build/tools/releasetools/ota_from_target_files --block -k "$KEY_DIR/releasekey" $OUT/$TARGET_FILES  $OUT/$DEVICE-ota_update-$BUILD.zip

build/tools/releasetools/img_from_target_files -v $OUT/$TARGET_FILES $OUT/$DEVICE-img-$BUILD.zip

TWRP will install $DEVICE-ota_update-$BUILD.zip, but failed to install $DEVICE-img-$BUILD.zip: Failed to install, invalid zip file format!. fastboot update $OUT/$DEVICE-img-$BUILD.zip works.

TWRP version twrp-3.1.1-0-grouper

  • 1
    From the looks of it, you're flashing a ROM you built yourself, quite different from what OP is encountering. No alternative zip is gonna solve OP's problem.
    – Andy Yan
    Jun 4, 2017 at 0:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .