【问题标题】:IONIC 3 - platform.ready() triggered slowlyIONIC 3 - platform.ready() 触发缓慢
【发布时间】:2018-09-20 21:41:53
【问题描述】:

我在 Ionic 框架中开发了 Android 应用程序,

我在我的应用程序中使用了 23 个插件

当打开 Application 时,Platform.ready() 状态很晚才被触发。

这需要很多时间。我们如何改进它?

基于该应用程序启动时间在 Android 6.0 及更高版本的设备中需要 5 到 7 秒。

我在 config.xml 中使用了以下插件

我的样品 一个很棒的 Ionic/Cordova 应用程序。 离子框架团队

<platform name="android">
    <allow-intent href="market:*" />
    <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
    <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
    <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
    <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
    <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
    <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
    <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
    <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
    <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
    <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
    <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
    <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
    <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
    <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
    <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
    <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
    <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
    <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
    <icon height="57" src="resources/ios/icon/icon.png" width="57" />
    <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
    <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
    <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
    <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
    <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
    <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
    <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
    <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
    <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
    <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
    <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
    <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
    <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
    <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
    <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
    <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
    <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
    <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
    <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
    <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
    <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
    <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
    <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
    <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
    <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
    <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
    <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
    <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
    <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
    <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
    <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
</platform>
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^2.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-plugin-advanced-http" spec="^2.0.1" />
<plugin name="cordova-plugin-android-permissions" spec="^1.0.0" />
<plugin name="cordova-plugin-background-mode" spec="^0.7.2" />
<plugin name="cordova-plugin-calendar" spec="^5.1.2" />
<plugin name="cordova-plugin-camera" spec="^4.0.3" />
<plugin name="cordova-plugin-datepicker" spec="^0.9.3" />
<plugin name="cordova-plugin-file" spec="^6.0.1" />
<plugin name="cordova-plugin-file-transfer" spec="^1.7.1" />
<plugin name="cordova-plugin-filepath" spec="^1.4.2" />
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="^1.1.1" />
<plugin name="cordova.plugins.diagnostic" spec="^4.0.10" />
<plugin name="cordova-plugin-network-information" spec="^2.0.1" />
<engine name="android" spec="7.0.0" />
<plugin name="cordova-plugin-fcm-with-dependecy-updated" spec="^2.2.4" />
<plugin name="cordova-plugin-geolocation" spec="^2.2.4" />

<plugin name="cordova-plugin-dreamover-uid" spec="^2.2.4" />

<plugin name="de.applant.cordova.plugin.localnotification" spec="^2.2.4" />

注意: 我已经使用了以下命令

ionic cordova 运行 android --prod

【问题讨论】:

  • 也许你需要检查你的原生插件。如果你添加一种人行横道,那么它可能会很慢。
  • @HyuckKang 抱歉,我听不懂。你能详细解释一下吗...
  • 你能添加你的config.xml吗?
  • @HyuckKang 我编辑了我的问题。请检查它..
  • 我找不到导致问题的特定插件。我认为每次添加插件时都值得重新创建项目并构建项目。

标签: android ionic-framework ionic3


【解决方案1】:

尝试使用ionic cordova run android --prod cmd 获取apk。当您正常运行时,它将使用角度开发模式运行,这将需要时间触发platform.reddy()。我认为这会对您有所帮助。

【讨论】:

  • 我也试过了,之后只有 12 秒的慢速减少到 5 到 7 秒。但我期待更好的表现......
  • 你用过的插件列表有哪些?
  • 我已经编辑了我的问题。它有插件信息。请检查一下
  • 我认为插件没有问题,请您尝试删除平台并重新添加并尝试上述cmd。
猜你喜欢
  • 1970-01-01
  • 2021-09-15
  • 1970-01-01
  • 2018-10-04
  • 1970-01-01
  • 1970-01-01
  • 2015-06-30
  • 2012-09-06
  • 1970-01-01
相关资源
最近更新 更多