Android 5.1编译大于2G的OTA包是会出 Android OverflowError: size does not fit in an int或者would require ZIP64 ex
来源:互联网 发布:票乎为什么停止运营 编辑:程序博客网 时间:2024/05/24 06:45
Android 5.1编译大于2G的OTA包是会出 AndroidOverflowError: size does not fit in an int或者would require ZIP64extensions,这样的错误
网上的解决方法只能解决第二种错误
当system分区预制过多apk时如果img size超过2G 在make otapackage时会报如下错误
zipfile.LargeZipFile: Zipfile size wouldrequire ZIP64 extensions
或
in writestr zinfo.CRC = crc32(bytes) &0xffffffff # CRC-32 checksum OverflowError: size does not fit in an int
//http://blog.csdn.net/sergeycao
这是由于python 2.7 脚本限制
参考/prebuilts/python/linux-x86/2.7.5/lib/python2.7/
ZIP64_LIMIT = (1 << 31) - 1 (31bits相当于2G)
python 3.0+ 已提供solution, 但目前Android 编译环境使用2.x 语法与 3.0不兼容
对此google提供一个workaround solution
参考以下网址有提供详细patch内容
https://android-review.googlesource.com/#/c/142984
(但此方法占时提高write size 到32bits相当于4G, 如果超过4G仍会出现问题)
另外还需修改一下脚本 build/tool/releasetools/
1、sign_target_files_apks
2、replace_img_from_target_files.py
3、ota_from_target_files
4、img_from_target_files.py
5 、img_from_target_files
6、common.py
7、add_img_to_target_files
针对所有zipfile.ZipFile 添加最后allowZip64=True 参数值
ex:
原始文件:
output_zip =zipfile.ZipFile(filename, "a", compression=zipfile.ZIP_DEFLATED)
修改为:
output_zip =zipfile.ZipFile(filename, "a", compression=zipfile.ZIP_DEFLATED,allowZip64=True)
跟踪源代码发现,
./build/tools/releasetools/add_img_to_target_files
def AddSystem(output_zip,prefix="IMAGES/", recovery_img=None, boot_img=None):
"""Turn the contents of SYSTEM into a system image andstore it in
output_zip."""
prebuilt_path = os.path.join(OPTIONS.input_tmp, prefix,"system.img")
ifos.path.exists(prebuilt_path):
print "system.img already exists in %s, no need to rebuild..."% (prefix,)
return
defoutput_sink(fn, data):
ofile = open(os.path.join(OPTIONS.input_tmp,"SYSTEM",fn),"w")
ofile.write(data)
ofile.close()
ifOPTIONS.rebuild_recovery:
print("Building new recovery patch")
common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, recovery_img,boot_img,
info_dict=OPTIONS.info_dict)
block_list = common.MakeTempFile(prefix="system-blocklist-",suffix=".map")
imgname = BuildSystem(OPTIONS.input_tmp, OPTIONS.info_dict,
block_list=block_list)
print"======================================================================================imgname:",imgname
# with open(imgname,"rb") as f:
# common.ZipWriteStr(output_zip, prefix + "system.img",f.read())
# withopen(block_list, "rb") as f:
# common.ZipWriteStr(output_zip, prefix + "system.map",f.read())
print"system", prefix +"system.img"
with open(imgname,"rb") as f:
output_zip.write(imgname, prefix + "system.img")
with open(block_list,"rb") as f:
output_zip.write(block_list, prefix + "system.map")
ZipWriteStr不能支持大于2G的文件, Write就没这种限制
./build/releasetools/common.py
def_WriteUpdate(self, script, output_zip):
partition = self.partition
# withopen(self.path + ".transfer.list", "rb") as f:
# ZipWriteStr(output_zip, partition + ".transfer.list",f.read())
# withopen(self.path + ".new.dat", "rb") as f:
# ZipWriteStr(output_zip, partition + ".new.dat", f.read())
# withopen(self.path + ".patch.dat", "rb") as f:
# ZipWriteStr(output_zip, partition + ".patch.dat", f.read(),
# compression=zipfile.ZIP_STORED)
with open(self.path+ ".transfer.list", "rb") as f:
output_zip.write(self.path +".transfer.list", partition + ".transfer.list")
with open(self.path+ ".new.dat", "rb") as f:
output_zip.write(self.path + ".new.dat", partition +".new.dat")
with open(self.path+ ".patch.dat", "rb") as f:
output_zip.write(self.path +".patch.dat", partition + ".patch.dat",
zipfile.ZIP_STORED)
call = (('block_image_update("%s", '
'package_extract_file("%s.transfer.list"), '
'"%s.new.dat", "%s.patch.dat");\n') %
(self.device, partition, partition, partition))
script.AppendExtra(script._WordWrap(call))
- Android 5.1编译大于2G的OTA包是会出 Android OverflowError: size does not fit in an int或者would require ZIP64 ex
- One size does not fit all
- One Size Does Not Fit All
- android Exported does not require permission
- How to scroll an image, if it does not fit in the display
- android - Warning: Exported activity does not require permission
- android 警告:Exported activity does not require permission
- android xml Exported service does not require permission
- Android Exported service does not require permission警告
- android 警告:Exported activity does not require permission
- Android:Exported receiver does not require permission解决办法
- [问题记录]hadoop/hdfs/name is in an inconsistent state: storage directory(hadoop/hdfs/data/) does not ex
- Android 警告:Exported activity does not require permission 的原因及解决方法
- Collections.copy 报错: Source does not fit in dest
- What does "size" in int(size) of MySQL mean?
- Android官方资料--Reducing OTA Size
- Application does not specify an API level requirement! -android
- 关于Android的This text field does not specify an inputType or a hint 问题
- Linux+PHP(5.4+)+MEMCACHE
- android自定义keystore操作
- 继承SimpleCursorAdapter定制Adapter
- HELLO WORLD
- Android内存优化之一:MAT使用入门
- Android 5.1编译大于2G的OTA包是会出 Android OverflowError: size does not fit in an int或者would require ZIP64 ex
- 从源码的角度分析Thread、Looper、MessageQueue、Handler的关系
- zhphp framework (十八) php 验证类
- Objective-C总Runtime的那点事儿
- 删除文件
- 接口回调机制
- jQuery dataTable使用
- NSString转16进制 NSString转NSData Byte数组 转换成NSString byte数组 转换成NSString
- tengine 负载均衡备忘