美文网首页
cordova-hot-code-push-plugin 热更新

cordova-hot-code-push-plugin 热更新

作者: pumpkin1024 | 来源:发表于2021-02-19 15:10 被阅读0次

版本

<plugin name="cordova-hot-code-push-plugin" spec="~1.5.3" />
<engine name="android" spec="^7.1.4" />
<engine name="ios" spec="^4.5.5" />

配置

config.xml

<chcp>
     <auto-download enabled="true" />
     <auto-install enabled="true" />
     <!--XXX代表服务器地址-->
     <config-file url="https://XXX/www/chcp.json" />
</chcp>

cordova-hcp.json

{
  "name": "XXX",
  "autogenerated": true,
   // 包名
  "ios_identifier": "XXX",
  "android_identifier": "XXX",
  "update": "resume",
  // XXX代表服务器地址
  "content_url": "https://XXX/www"
}

报错

// 获取报错代码
chcp.fetchUpdate(function (error, data) {
      console.log('chcp debug');
      console.log('error', error);
      console.log('data', data);
});

error:{ code:-4, description: " failed to download update files" }

官方解释

FAILED_TO_DOWNLOAD_UPDATE_FILES - failed to download updated/new files from the server. Check your chcp.manifest file: all listed files must be placed in the content_url from the application config. Also, check their hashes: they must match to the hashes in the chcp.manifest. Error code value is -4.(意思是线上的文件和chcp.manifest的不符合)

解决

找了一大圈 最后发现由于webpack打包多个js 在上传阿里云oss时一次性最多只能传100个文件,但是整个www文件超过了100个 所以线上只有100个文件 与chcp.manifest的文件不符合 因此失败

参考

文档地址

相关文章

  • cordova 一些使用记录

    cordvoa 套壳 代码热更新插件 cordova-hot-code-push-plugin超级必要插件的作用是...

  • ionic4 使用热更新插件问题

    以前写过另外一篇文章:Ionic 热更新实践笔记,讲了 cordova-hot-code-push-plugin ...

  • cordova-hot-code-push-plugin 热更新

    版本

    cordova-hot-code-push-plugin热更新遇

    公司用的ionic混合开发,用到一个cordova热更新插件cordova-hot-code-push-plugi...

  • Cordova热更新实现

    cordova-hot-code-push-plugin npm cordova-hot-code-push gi...

  • 热更新

    参考文章 https://www.jianshu.com/p/2f356e3276b8

  • 热更新

    热更新技术背景 1.热更新定义,APP热更新,就是指软件不通过苹果APP Store的版本更新审核,直接可以自行更...

  • 热更新

    mono热更新 更新过程中强退导致dll损坏 问题的产生是这样的:我们的代码文件随着开发会越来越打,当更新一个 d...

  • 热更新

    需要前端把更新后的代码生成chcp.manifest 第一部: npm i -g cordova-hot-...

  • 热更新

    腾讯热更新 https://gold.xitu.io/post/584a70feac502e00691c4a07 ...

网友评论

      本文标题:cordova-hot-code-push-plugin 热更新

      本文链接:https://www.haomeiwen.com/subject/pssaxltx.html