cocoscreate项目内嵌 android app问题汇总及解决方案

  • Creator 版本:3.6.0

  • 目标平台: webmobile(只测试了Android)

  • 重现方式:Android8(小部分)及以下手机

  • 现象: 低版本手机运行崩溃或者无法使用websocket

现象1:websocket 无法使用或者导致崩溃,报错 VALIDATION_ERROR_DESERIALIZATION_FAILED
解决方案:socket 在原生中实现,可以参考https://github.com/anismiles/websocket-android-phonegap

现象2:XMLHttpRequest 在readyState status都正常情况下,responseText上没有数据
解决方案:接口返回字符串,如果是json格式的,需要2次jsonstring,即带 \ 的字符串

现象3:error fetching sysytemjs-import map file’…unable to resolve bare specifier ’cc‘
解决方案:参考帖子 cocos creator3.6.0打包作为webview嵌入app报错

现象4: [System is not defined],报错定位在system.bundle.js 中的函数 promisePrototypeFinally
解决方案:参考 https://github.com/systemjs/systemjs 替换 promisePrototypeFinally 方法

现象5:渲染黑屏,提示 Command ‘updateBuffer’ must be recorded outside a render pass.
解决方能:项目-项目设置-功能裁剪 去掉webgl2 , 推测是部分手机对webgl2支持不够完善

ps:上传文件为已修改好代码,根据实际情况去替换,本次测试只到了Android6,更低版本没覆盖到
build-templates.zip (14.3 KB) com.zip (24.3 KB)

6赞

请问官方有没有creator3.x版本内嵌到iOS原生app成功的案例?求教; 楼主有没有经验求教

ios的没弄过,原理应该差不多的吧