首页 > 解决方案 > nativescript 应用程序在 android 设备上导航时运行缓慢并死机,但在 ios 上运行良好

问题描述

我已经用尽了网上可用的任何建议。我尝试在 package.json 中设置markingMode

"android": {
    "markingMode": "none"
}

我尝试了几种加载视图模型的方法。我尝试保存到物理文件并从中读取。我尝试将每个视图的 json 数据加载到 appSettings 中。

我试过卸载 sass 插件 sidedrawer 插件。我已经更新了所有插件,包括核心组件。

这是插件/版本

  nativescript-appversion          │ ^1.4.1  │ │
  nativescript-iqkeyboardmanager   │ ^1.4.0  │ │
  nativescript-keyboard-toolbar    │ ^1.0.4  │ │
  nativescript-local-notifications │ ^3.1.0  │ │
  nativescript-orientation         │ ^2.2.1  │ │ 
  nativescript-pager               │ ^9.3.14 │ │ 
  nativescript-plugin-firebase     │ ^8.0.0  │ │
  nativescript-pulltorefresh       │ ^2.2.0  │ │
  nativescript-social-share        │ ^1.5.1  │ │ 
  nativescript-sound               │ ^1.0.4  │ │ 
  nativescript-ui-sidedrawer       │ ^6.0.0  │ │
  nativescript-windowed-modal      │ ^5.0.6  │ │ 
  rxjs                             │ ^6.3.3  │ │ 
  tns-core-modules                 │ ^5.2.2

应用程序应该能够导航不同的视图而不会冻结或减速。

标签: nativescript

解决方案


我面临着完全相同的问题。使用下面的配置/src/package.json,而不是在主 package.json 中。

{
  "main": "main.js",
  "android": {
    "v8Flags": "--expose_gc",
    "markingMode": "none"
  }
}

更多信息在这里:https ://www.nativescript.org/blog/markingmode-none-is-official-boost-android-performance-while-avoiding-memory-issues


推荐阅读