Ionic2中的闪屏后的白色屏幕

时间:2017-09-25 19:53:16

标签: ionic2 wait splash-screen

当我将应用程序转换为* .apk时,执行启动画面后我的白屏问题很小,需要20到25秒,然后我的应用程序运行正常。

是否有任何设置或代码或任何工具可以解决此问题?

备注

  

〜申请人数:19mb

     

〜测试三星galaxy J7 2016 - android 7.0

     

〜我用这种方式将我的应用转换为apk:How to generate ionic apk or ios without extra applications?

2 个答案:

答案 0 :(得分:2)

使用

  

离子构建android --prod

启动时间将缩短至5秒,白色屏幕

问题是启动画面自动隐藏,因此请禁用启动画面自动隐藏和

  

app.component.ts

我手动隐藏它。

  

config.xml中

<preference name="SplashMaintainAspectRatio" value="true"/>
 <preference name="SplashScreen" value="screen"/>
 <preference name="SplashScreenDelay" value="30000"/>
 <preference name="AutoHideSplashScreen" value="false"/>
 <preference name="SplashShowOnlyFirstTime" value="false"/>
 <preference name="FadeSplashScreen" value="false"/>
  

app.component.ts

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
@Component({
 templateUrl: 'app.html'
})
export class MyApp {
 rootPage:string = 'HomePage';
 constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
 platform.ready().then(() => {
 // Okay, so the platform is ready and our plugins are available.
 // Here you can do any higher level native things you might need.
 statusBar.styleDefault();
 splashScreen.hide();
 });
 }
}

答案 1 :(得分:1)

要构建您的apk文件,请使用:

ionic build android 
(or) ionic cordova build android (In ionic3)

要在设备中运行您的应用,请使用:

ionic run android (ionic cordova run android)
(or) ionic run android --livereload (for live reload) (ionic cordova run android --livereload)

详细了解ioni cli
使用调试模式,20s启动应用程序正常。使用ionic build变量运行--prod,您会看到您的应用启动速度更快,但需要更长时间才能构建。