Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
167 views
in Technique[技术] by (71.8m points)

android - Zip file modified when added to Phonegap app?

I am writing a Phonegap app that includes a zip archive in the /assets/www/ folder. When the app is launched the file is copied to the fileSystem root. When I try to read the header, it appears that the file has been modified.

Here's the hexdump on my computer:

# hexdump -C Archive.zip| more
00000000  50 4b 03 04 14 00 00 00  08 00 4c b7 b1 40 84 1d  |PK........L..@..|
00000010  9b 1a 21 00 00 00 a0 01  00 00 0a 00 1c 00 73 61  |..!...........sa|

Here's the hexdump of the file in /sdcard/:

hexdump -C Archive.zip| more

00000000  50 4b 03 04 14 00 00 00  08 00 4c ef bf bd ef bf  |PK........L.....|
00000010  bd 40 ef bf bd 1d ef bf  bd 1a 21 00 00 00 ef bf  |.@........!.....|
00000020  bd 01 00 00 0a 00 1c 00  73 61 6d 70 6c 65 2e 74  |........sample.t|

HOUSTON! WE HAVE A PROBLEM!

So, who moved my cheese? What happened? Since .apk files are zipped folders, is there a potentially destructive side-effect of adding a zip file into a zip file?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Android uses a special zip alignment. This could be your problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...