热更新完成后 奔溃

creator v 2.2.1
模拟器

调用 cc.game.restart(); 之后就奔溃 求解决

Simulator: E/jswrapper (272): ERROR: Uncaught ReferenceError: _CCSettings is not defined, location: main.js:0:0
STACK:
[0]boot@main.js:5
[1]anonymous@main.js:95
[2]anonymous@main.js:97
E/jswrapper (673): ScriptEngine::evalString script main.js, failed!
at HTMLElement.print-simulator-log (D:\software\CocosCreator\resources\app.asar\editor\builtin\scene\panel\messages\scene.js:1:1608)
at Object.e._dispatch (D:\software\CocosCreator\resources\app.asar\editor-framework\lib\renderer\panel.js:1:1876)
at EventEmitter. (D:\software\CocosCreator\resources\app.asar\editor-framework\lib\renderer\ipc.js:1:2952)
at EventEmitter.emit (events.js:194:13)

试试2.2.2版本,这个问题在2.3版本没有复现

Simulator: D/jswrapper (130): JS: cocos2dx --------------游戏重启--------------
Simulator: D/jswrapper (453): ScriptEngine::cleanup begin …
Simulator: D/jswrapper (592): GC begin …, (js->native map) size: 340, all objects: 583
Simulator: D/jswrapper (643): XMLHttpRequest_finalize, 0D6EBB38 …
Simulator: D/jswrapper (600): GC end …, (js->native map) size: 138, all objects: 382
Simulator: D/jswrapper (592): GC begin …, (js->native map) size: 138, all objects: 381
Simulator: D/jswrapper (600): GC end …, (js->native map) size: 138, all objects: 381
Simulator: D/jswrapper (592): GC begin …, (js->native map) size: 0, all objects: 0
Simulator: D/jswrapper (600): GC end …, (js->native map) size: 0, all objects: 0
Simulator: D/jswrapper (514): ScriptEngine::cleanup end …
Simulator: RuntimeEngine already has Runtime type 2.
Simulator: resetDesignResolution request
Simulator: ------------------------------------------------
Simulator: LOAD Js FILE: jsb-adapter/jsb-builtin.js

Simulator: ------------------------------------------------
Simulator: D/jswrapper (367): Initializing V8, version: 7.5.288.22
Simulator: D/jswrapper (813): libuv version: 1.13.1
Simulator: D/jswrapper (112): Debugger listening…, visit [ chrome-devtools://devtools/bundled/inspector.html?v8only=true&ws=0.0.0.0:5086/00010002-0003-4004-8005-000600070008 ] in chrome browser to debug!
Simulator: D/jswrapper (115): For help see https://nodejs.org/en/docs/inspector
Simulator: D/jswrapper (130): JS: Enable batch GL commands optimization!
Simulator: resetDesignResolution request
Simulator: ------------------------------------------------
Simulator: LOAD Js FILE: main.js
Simulator: ------------------------------------------------

Simulator: libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
E/jswrapper (176): [ERROR] (f:\jenkins\workspace\creator_2d\cocos2d-x-lite\windows\cocos2d-x-lite\cocos\scripting\js-bindings\manual\jsb_global.cpp, 176): Can’t decrypt code for src/settings.jsc
E/jswrapper (710): ScriptEngine::runScript script src/settings.js, buffer is empty!
E/jswrapper (292): [ERROR] Failed to invoke require, location: f:\jenkins\workspace\creator_2d\cocos2d-x-lite\windows\cocos2d-x-lite\cocos\scripting\js-bindings\manual\jsb_global.cpp:292

Simulator: E/jswrapper (272): ERROR: Uncaught ReferenceError: _CCSettings is not defined, location: main.js:0:0
STACK:
[0]boot@main.js:5
[1]anonymous@main.js:95
[2]anonymous@main.js:97
E/jswrapper (673): ScriptEngine::evalString script main.js, failed!
at HTMLElement.print-simulator-log (D:\software\CocosCreator\resources\app.asar\editor\builtin\scene\panel\messages\scene.js:1:1608)
at Object.e._dispatch (D:\software\CocosCreator\resources\app.asar\editor-framework\lib\renderer\panel.js:1:1876)
at EventEmitter. (D:\software\CocosCreator\resources\app.asar\editor-framework\lib\renderer\ipc.js:1:2952)
at EventEmitter.emit (events.js:194:13)

我有测试了一下,和这个cc.game.restart()没有直接关系
大佬们看看 说明问题?

我试了一下,不是版本问题;也不是cc.game.restart()函数的问题,求解决

你打包的时候有在mian.js中加那段很重要的代码吗?

。。。有

哦,你是模拟器啊,我没有用模拟器测过热更,直接真机测得。所以不知道模拟器是不是需要特别得操作。

Creator内置的模拟器不支持热更新测试,请打APP包测试

真机上也是这个错误,我demo给你了,帮我看一下吧,谢了

貌似是你settings脚本有问题 或者没找到

还没有,谁解决了。

这是ios日志

JS: --------------游戏重启--------------
ScriptEngine::cleanup begin …
GC begin …, (js->native map) size: 100, all objects: 349
XMLHttpRequest_finalize, 0x10be1c390 …
GC end …, (js->native map) size: 81, all objects: 331
GC begin …, (js->native map) size: 81, all objects: 330
GC end …, (js->native map) size: 81, all objects: 330
GC begin …, (js->native map) size: 0, all objects: 0
GC end …, (js->native map) size: 0, all objects: 0
ScriptEngine::cleanup end …
Initializing V8, version: 7.5.288.22
libuv version: 1.23.1-dev
Debugger listening…, visit [ chrome-devtools://devtools/bundled/inspector.html?v8only=true&ws=0.0.0.0:6086/00010002-0003-4004-8005-000600070008 ] in chrome browser to debug!
For help see https://nodejs.org/en/docs/inspector
JS: Enable batch GL commands optimization!
JS: hotUpdateSearchPaths: ["/var/mobile/Containers/Data/Application/290C1017-29A3-4596-9C4C-3DD017F2CD8D/Documents/updataDir/1.0.1/",""]
[ERROR] (/Users/Environment/Project/wlhb/build/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_global.cpp, 178): Can’t decrypt code for src/settings.jsc
ScriptEngine::runScript script src/settings.js, buffer is empty!
[ERROR] Failed to invoke require, location: /Users/Environment/Project/wlhb/build/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/manual/jsb_global.cpp:294
ERROR: Uncaught TypeError: Cannot read property ‘debug’ of undefined, location: main.js:0:0
STACK:
[0]window.boot@main.js:13
[1]anonymous@main.js:200
ScriptEngine::evalString script main.js, failed!

看起来就是在main.js里报的错
你看一下main.js是不是有什么问题吧

我这个没有子游戏,main这个文件就加了一个保存下载目录

抬一下杠,是崩溃,不是奔溃

是不是因为你的解密密码写错了

上面有崩溃日志,js解压密码和c++里面的的里面的一样

从错误来看推测是 src/settings.js 找不到,有可能是你在远端的文件没有加密或者是打包使用的引擎版本不同