uni-app wgt更新时安卓卡在启动页时间过长
uni-app wgt更新时安卓卡在启动页时间过长
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Windows | win11 | HBuilderX |
产品分类:uniapp/App
PC开发环境操作系统:Windows
PC开发环境操作系统版本号:win11
HBuilderX类型:正式
HBuilderX版本号:4.75
手机系统:Android
手机系统版本号:Android 14
手机厂商:华为
手机机型:荣耀Play9T
页面类型:vue
vue版本:vue2
打包方式:云端
项目创建方式:HBuilderX
### 操作步骤:
07-31 12:07:39.521 21672 26166 D appmgr : install end useTime=3117
07-31 12:07:39.598 21672 21672 I HwViewRootImpl: removeInvalidNode all the node in jank list is out of time
07-31 12:07:47.806 21672 21672 D HnContentRecognizerManager: getCloudConfigsBundle: get cache value
07-31 12:07:47.806 21672 21672 D HnContentRecognizerManager: getCloudConfigsBundle: get cache value
07-31 12:07:47.807 21672 21672 I HiTouch_PressGestureDetector: checkDoublePointerLimit:xPoss,yPoss:436,903
07-31 12:07:47.866 21672 21672 D HnContentRecognizerManager: getCloudConfigsBundle: get cache value
07-31 12:07:47.866 21672 21672 D HnContentRecognizerManager: getCloudConfigsBundle: get cache value
07-31 12:07:47.867 21672 21672 W HiTouch_PressGestureDetector: action:Up,touchSlop:16,interrupted:false
...
### 预期结果:
正常进入
### 实际结果:
卡在启动页
### bug描述:
wgt 热更后 使用 plus.runtime.restart(); 重启, 会长时间卡在启动页
更多关于uni-app wgt更新时安卓卡在启动页时间过长的实战教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复
更多关于uni-app wgt更新时安卓卡在启动页时间过长的实战教程也可以访问 https://www.itying.com/category-93-b0.html
在wgt热更新后调用plus.runtime.restart()导致安卓端长时间卡在启动页,通常与资源加载或初始化过程有关。从日志时间戳看,安装耗时约3秒(3117ms),但后续出现大量HnContentRecognizerManager缓存查询记录,表明系统可能在执行非必要的资源预加载。
可能原因及解决方案:
-
资源验证耗时:热更新后应用需重新校验资源完整性。建议在
manifest.json中减少启动时加载的页面复杂度,或检查是否包含过大的静态资源。 -
生命周期冲突:重启时若存在未释放的缓存或监听事件,可能阻塞新实例初始化。可在调用重启前手动清理:
plus.runtime.restart();
// 尝试先关闭所有页面
const currentWebview = plus.webview.currentWebview();
currentWebview.close();
- 原生层限制:部分华为机型对热更新重启存在兼容性问题。可改用原生重启方案:
// 通过原生意图强制重启
const Intent = plus.android.importClass('android.content.Intent');
const activity = plus.android.runtimeMainActivity();
const intent = new Intent(activity, activity.getClass());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(intent);
plus.android.invoke(activity, 'finish');

