Ionic-framework: deviceready has not fired after 5 seconds on every new project

Created on 22 Apr 2017  路  11Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[ ] 2.x
[x ] 3.x

I'm submitting a ... (check one with "x")
[ x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
After install node, cordova, gulp, bower and ionic, i made a new project with:
ionic start test sidemenu
running this project always throws:

04-22 20:34:09.766 20202 20202 I chromium: [INFO:library_loader_hooks.cc(163)] Chromium logging enabled: level = 0, default verbosity = 0
04-22 20:34:10.211 20202 20256 E chromium: [ERROR:child_thread_impl.cc(762)] Request for unknown Channel-associated interface: ui::mojom::GpuMain
04-22 20:34:19.087 20202 20202 I chromium: [INFO:CONSOLE(3324)] "Angular is running in the development mode. Call enableProdMode() to enable the production mode.", source: file:///android_asset/www/build/main.js (3324)
04-22 20:34:19.328 20202 20202 I chromium: [INFO:CONSOLE(1223)] "deviceready has not fired after 5 seconds.", source: file:///android_asset/www/cordova.js (1223)
04-22 20:34:19.330 20202 20202 I chromium: [INFO:CONSOLE(104166)] "Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.", source: file:///android_asset/www/build/main.js (104166)

On mobile device, it should ionic loader, then get a white screen for more than 5 secons, and then app apeears.

I try ALL the available templates, with same result

Expected behavior:
mobile app should run whitout blank screen or unexpected delays.

Steps to reproduce:

  1. Install node v7.9.0
  2. npm install -g ionic cordova gulp bower
  3. ionic start testproject runtime
  4. cd runtime
  5. ionic add platform android
  6. ionic run android

Related code:


Other information:
node version: v7.9.0

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.5.0 
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.8
Node Version: v7.9.0
Xcode version: Not installed

Most helpful comment

Im having the same problem about deviceready. But it's curious how it throws the error. First time i launch this command: ionic cordova run android -l -c , all runs fine. But after one change on code and performs livereload, im getting this on prompt:

[08:35:22]  console.log: Angular is running in the development mode. Call enableProdMode() to enable the production 
            mode. 
[08:35:22]  console.log: deviceready has not fired after 5 seconds. 
[08:35:22]  console.log: Channel not fired: onPluginsReady 
[08:35:22]  console.log: Channel not fired: onCordovaReady 
[08:35:22]  console.warn: Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an 
            inconsistent state. Try removing plugins from plugins/ and reinstalling them. 
[08:35:23]  console.log: Ionic Native: deviceready event fired after 5896 ms 

All 11 comments

Thanks for opening an issue with us.
When running ionic run android, it uses the angular JIT compiler, which is fast, but lacks on performance side.
Try running ionic run android --prod to utilise the AOT compiler, which is slow, but creates a smaller bundle, and generally comes with great performance benefits.

If you do the above, and you find there is still a problem with startup speed, please write your android device's model and android version.

@macklus, apart from --prod consider also creating a "splash" screen in your index.html file.

Adding something like "Loading..." and a spinner can improve UX.

Hello, all! @AmitMY is correct here. By default ionic run android does a dev build which uses the Angular JIT mode and does not do any minification or optimizations. This mode, while it builds fast and is great for debugging, is slow to start up and creates very large bundles. For the best on-device testing experience, especially with bigger apps, I would recommend doing a prod build. As @AmitMY mentions, our production build does build a little slower as its runs the Angular AOT compiler, does minification and more, but the end product that it builds starts up much faster.

Hi all !

using --prod seems to be ussefull, so thanks ;-)

I am having this same issue with all my ios builds. In fact, device ready is never fired at all:

export class MyApp {
  rootPage:any = TabsPage;

  constructor(platform: Platform, private storage: Storage, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
      console.log('### platform ready ');

Having the same problem on Android when compiling with AOT. The only indication I have in the debug console is:

``
deviceready has not fired after 5 seconds.

main.js:53 Ionic Native: deviceready event fired after 2340 ms
``

I'm a bit confused that I see both of these messages... intuitively I'd think only one of them should be displayed.

Any help?

Hii @AmitMY
I have tried this command ionic run android --prod then i have get this error
Error: Type AddCustomer in /home/serpentcs/IONICprojects/GMS/src/pages/add-customer/add-customer.ts is part of the declarations of 2 modules: AppModule in /home/serpentcs/IONICprojects/GMS/src/app/app.module.ts and AddCustomerModule in /home/serpentcs/IONICprojects/GMS/src/pages/add-customer/add-customer.module.ts! Please consider moving AddCustomer in /home/serpentcs/IONICprojects/GMS/src/pages/add-customer/add-customer.ts to a higher module that imports AppModule in /home/serpentcs/IONICprojects/GMS/src/app/app.module.ts and AddCustomerModule in /home/serpentcs/IONICprojects/GMS/src/pages/add-customer/add-customer.module.ts. You can also create a new NgModule that exports and includes AddCustomer in /home/serpentcs/IONICprojects/GMS/src/pages/add-customer/add-customer.ts then import that NgModule in AppModule in /home/serpentcs/IONICprojects/GMS/src/app/app.module.ts and AddCustomerModule in /home/serpentcs/IONICprojects/GMS/src/pages/add-customer/add-customer.module.ts.

Can you please guide me that what is going wrong on it?

While this is not the place for support, it is an easy fix, so I'll explain:
Just reading the error message, disregarding the paths:

AddCustomer is part of the declarations of 2 modules: AppModule and AddCustomerModule.

If AppModule imports AddCustomerModule, remove the decleration from either module.
If it is not, and you are using lazy loading or something, you can also create a new NgModule that exports and includes AddCustomer, then import that NgModule in AppModule and AddCustomerModule

It is such an informative error message.

Okk Thank You

Im having the same problem about deviceready. But it's curious how it throws the error. First time i launch this command: ionic cordova run android -l -c , all runs fine. But after one change on code and performs livereload, im getting this on prompt:

[08:35:22]  console.log: Angular is running in the development mode. Call enableProdMode() to enable the production 
            mode. 
[08:35:22]  console.log: deviceready has not fired after 5 seconds. 
[08:35:22]  console.log: Channel not fired: onPluginsReady 
[08:35:22]  console.log: Channel not fired: onCordovaReady 
[08:35:22]  console.warn: Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an 
            inconsistent state. Try removing plugins from plugins/ and reinstalling them. 
[08:35:23]  console.log: Ionic Native: deviceready event fired after 5896 ms 

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcovtwout picture marcovtwout  路  76Comments

infinnie picture infinnie  路  76Comments

wonderdogone picture wonderdogone  路  121Comments

aces-tm picture aces-tm  路  83Comments

TheMohanraj picture TheMohanraj  路  159Comments