sisong / ApkDiffPatch

a C++ library and command-line tools for Zip(Jar,Apk) file Diff & Patch; create minimal delta/differential; support Jar sign(apk v1 sign) & apk v2,v3 sign .
MIT License
310 stars 49 forks source link

ApkPatch返回码 #63

Closed Picasso1990 closed 4 years ago

Picasso1990 commented 4 years ago

您好,请问客户端进行patch过程的返回码是否如下含义呢?

PATCH_SUCCESS=0, //0. 成功 PATCH_OPENREAD_ERROR, //1. 输入流打开失败 PATCH_OPENWRITE_ERROR, //2. 输出流打开失败 PATCH_CLOSEFILE_ERROR, //3. 关闭文件失败 PATCH_MEM_ERROR, //4. 运存空见不足(malloc失败) PATCH_HPATCH_ERROR, //5. hpatch执行过程出错 PATCH_HDIFFINFO_ERROR, //6. diff文件信息错误(文件损坏? PATCH_COMPRESSTYPE_ERROR, //7. 解压缩出错 PATCH_ZIPPATCH_ERROR, //8. (不确定)zip输出流写入异常 PATCH_ZIPDIFFINFO_ERROR, //9. zip格式下的diff文件读入失败(不可读) PATCH_OLDDATA_ERROR, //10. 旧文件(旧apk)异常,跟diff文件里对不上 PATCH_OLDDECOMPRESS_ERROR, //11. 旧文件(旧apk)解压异常 PATCH_OLDSTREAM_ERROR, //12. 旧文件(旧apk)输入流异常 PATCH_NEWSTREAM_ERROR, //13. 新文件(新apk)输出流异常

谢谢~~~

sisong commented 4 years ago

是的; 如果是命令行调用(zip_patch.cpp)参数错误的话返回1,其他情况返回ZipDiff调用返回值;
ZipDiff函数调用返回值为patch/Patcher.h文件中定义的enum TPatchResult;

Picasso1990 commented 4 years ago

好的,谢谢哈

jamfing commented 1 year ago

PATCH_ZIPDIFFINFO_ERROR, //9. zip格式下的diff文件读入失败(不可读) 我这边patch的时候,一直报错误码9, 在pc上patch是正常的,想问下,这种一般是什么原因?

sisong commented 1 year ago

@jamfing
需要注意的几个问题:

  1. Apkdiffpatch 支持多线程并行patch,这时要求oldapk和newapk包都必须经过ApkNormalized处理过(否则patch会报错)。
  2. 多线程并行patch时,内存占用会比较大,比单线程时大得多,需要在设备上看看内存占用是否ok,否则只能用单线程apcth。
  3. 即使用的v1版apk签名,也建议始终对oldapk和newapk包进行ApkNormalized处理,这样能保证得到的newapk二进制完全一致;可以避免应用商店等其他app无法使用增量更新。