添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

目标平台 : Android

详细报错信息,包含调用堆栈 :没有错误信息

03-06 19:32:19.040 29577-29577/org.cocos2d.helloworld E/openSDK_LOG: org.cocos2d.helloworld SDK_VERSION:3.3.0.lite
03-06 19:32:19.240 29577-29606/org.cocos2d.helloworld E/cocos2d-x: cocos2d: warning, Director::setProjection() failed because size is 0

重现方式

  • 将当前版本作为最新版本B
  • 删除当前版本某些功能作为作为上一个版本A
  • 将A、B版本分别打包功能正常
  • A版本升级到B版本,始终无法获得最新功能
  • 只改变版本号,将A最为最新版本,B升级到A正常升级
  • 之前哪个版本是正常的

    将功能多的版本B升级到功能少的版本A,正常

    手机型号:华为荣耀,小米5S

    出现概率:100%

    额外线索

  • 资源正常下载,并进行了重启。重启后查看调试日志,在资源管理器检测更新后又自动将manifestRootPath添加到了默认的资源搜索路径前,但缓存的清单文件cachedManifest文件存在,具体调试日志如下
  • init-->searchPath: ["assets/"], cacheManifestIsExist: false
    storageSearchPathFiles: ["/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/./","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/../"]
    checkUpdate before-->searchPath: ["assets/res/raw-assets/","assets/"]
    checkUpdate after-->searchPath: ["assets/res/raw-assets/","assets/"]
    restartGame-->searchPath: ["/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/","assets/res/raw-assets/","assets/"]
    restartGame-->newSearchPath: ["/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/"], HotUpdateSearchPaths: ["/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/","assets/res/raw-assets/","assets/"]
    restartGame-->localHotUpdateSearchPath: "[\"/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/\",\"/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/\",\"assets/res/raw-assets/\",\"assets/\"]"
    init-->searchPath: ["/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/","assets/res/raw-assets/","assets/"], cacheManifestIsExist: true
    storageSearchPathFiles: ["/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/./","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/../","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/src/","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/res/","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/project.manifest"]
    checkUpdate before-->searchPath: ["assets/res/raw-assets/","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/","assets/res/raw-assets/","assets/"]
    checkUpdate after-->searchPath: ["/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/","/data/data/org.cocos2d.helloworld/files/eliminate-remote-asset/","assets/res/raw-assets/","assets/"]
     2324209458:
    

    我在A版本添加更新检测,检测到B版本,更新后重启B版本,再次检测热更新就不行。如果B版本不检测热更新,也就不会把manifestRoot添加到搜索路径前,然后资源就正

    热更跟着官网那个 热更走 肯定是可以的 至少我是可以的了
    代码方面 他那个工具我没用

    官方demo,检测到已更新,并没有重启引擎,导致更新资源目录没生效,下面这个分支加个代码。
    case jsb.EventAssetsManager.ALREADY_UP_TO_DATE:
    needRestart = true; // 添加这句代码

    第一次重启生效,第二次启动不生效,很可能是因为调用了cc.sys.localStorage.clear();这个方法,今天刚好踩到这个坑里了。
    热更新下载资源完成后 ,会将新的资源路径保存到本地缓存中
    cc.sys.localStorage.setItem(‘HotUpdateSearchPaths’, JSON.stringify(searchPaths));
    重启之后, 如果调用了cc.sys.localStorage.clear()这个方法,下次重启进来就回到原来的版本了!!!!!!