Deviceready event not firing in Android DevApp (deviceready has not fired after 5 seconds)


#1

So I’m just getting started with Ionic, and I’ve run into the problem that deviceready doesn’t fire (in time), which seems kinda wide spread, at least I could find quite a lot of topics about it all over the net.

I’ve installed a new blank app via ionic start test blank, then I ran it via ionic serve -c --no-open, and finally opened it in the Android Ionic DevApp. The app will open after a few seconds, but the ready() code won’t run.

> ionic serve -c --no-open
Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --consolelogs
–nobrowser - Ctrl+C to cancel
[00:18:28] watch started …
[00:18:28] build dev started …
[00:18:28] clean started …
[00:18:28] clean finished in 7 ms
[00:18:28] copy started …
[00:18:28] deeplinks started …
[00:18:28] deeplinks finished in 21 ms
[00:18:28] transpile started …
[00:18:31] transpile finished in 3.28 s
[00:18:31] preprocess started …
[00:18:31] preprocess finished in 2 ms
[00:18:31] webpack started …
[00:18:31] copy finished in 3.45 s
[00:18:37] webpack finished in 6.17 s
[00:18:37] sass started …
[00:18:38] sass finished in 1.01 s
[00:18:38] postprocess started …
[00:18:38] postprocess finished in 7 ms
[00:18:38] lint started …
[00:18:38] build dev finished in 10.66 s
[00:18:39] watch ready in 10.73 s
[00:18:39] dev server running: http://localhost:8100/

[OK] Development server running!
Local: http://localhost:8100
External: http://192.168.2.101:8100, http://192.168.56.1:8100, http://192.168.13.1:8100, http://55.55.55.1:8100,
http://169.254.249.34:8100, http://192.168.144.1:8100, http://192.168.91.1:8100, http://192.168.21.1:8100
DevApp: test@8100 on admin-PC

[00:18:41] lint finished in 2.78 s
[00:18:53] console.log: Angular is running in the development mode. Call enableProdMode() to enable the production
mode.
[00:18:54] console.log: deviceready has not fired after 5 seconds.
[00:18:54] console.log: Channel not fired: onFileSystemPathsReady
[00:18:56] 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.

I’ve read a bunch of topics about this, but most of them seem to be about running the app via ionic run ..., and all the suggestions like adding/removing a content security policy, adding/removing/adding platforms do not fix the problem for me.

It should also be noted that I do not have any (additional) plugins installed, as it’s just the blank app template, so the suggestion in the warning message isn’t applicable.

So, what is this all about, is there a proper solution for this? Is there a way to debug this further on my end?

> ionic info

cli packages: (C:\Users\admin\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.18.0
ionic (Ionic CLI) : 3.18.0

local packages:

@ionic/app-scripts : 3.1.2
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v8.9.1
npm  : 5.3.0
OS   : Windows 7

Misc:

backend : pro

Phone Info

OS: OxygenOS 3.1.4
Android-Version: 6.0.1


Ionic DevApp Feedback Mega-thread
The life without Ionic
#2

On further investigation the ready() handler is being invoked when removing cordova.js, ie the following tag in index.html:

<script src="cordova.js"></script>

Of course that’s not a fix. Also the deviceready event still doesn’t seem to fire, manually subscribing to the event in index.html via:

document.addEventListener('deviceready', function () { console.log('index ready') });

won’t do anything, it’s never being invoked.


#3

Same issue here.
Only when using devapp.
Runing on device it’s ok.


#4

We have the same issue with our App.

That’s really unfortunate. The DevApp seemed to be a nice tool to simplify tests.


#5

Same here.

ionic cordova run android

works well.

DevApp has an issue on Android


#6

Same here with testing on Android.

ionic cordova run android

works.

DevApp dosn’t work even with an empty fresh project. I’am pro member and realy need this feature.


#7

Same here for both Platforms IOS and Android. I’ve tried it out with NativeStorage and unfortunately it does not work. Fails with the following error with DevApp an ionic serve -c:

console.log: deviceready has not fired after 5 seconds. 
console.log: Channel not fired: onPluginsReady 
console.log: Channel not fired: onCordovaReady 

#8

Has anyone here reported it on Ionic Support? If Not I will


#9

I have the same problem.
Using the NativeStorage.

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.2
    Cordova Platforms  : android 6.3.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node  : v8.9.1
    npm   : 5.6.0
    OS    : macOS High Sierra
    Xcode : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

#10

same problem trying to use NativeStorage

console.log: deviceready has not fired after 5 seconds.
console.log: Channel not fired: onFileSystemPathsReady

#11

I have the same issue on Android and Ionic DevApp.
With Ionic View the event is fired correctly.

On iOs All OK, DevApp and View.

My config

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0 

local packages:

@ionic/app-scripts : 3.1.5
Cordova Platforms  : android 6.3.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

ios-deploy : 1.9.2 
ios-sim    : 5.0.12 
Node       : v8.9.3
npm        : 5.5.1 
OS         : macOS High Sierra
Xcode      : Xcode 9.2 Build version 9C40b 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

#12

I linked this thread to the main devapp thread. Hopefully we’ll get a solution soon. Ionic DevApp Feedback Mega-thread


#13

I have the same Problem and I can’t test it on my Ipad 4 (ios 9.2.1) because there the DevApp crashes instantaneously after the loading screen - so I need the devApp to work on android with device ready.

UPDATE:
I resolved it, by calling the code for starting also over an event, when i press a button on the loading screen:

platform.ready().then(() => {
      this.start();
    });
    this.events.subscribe("DevAPP:Force_DeviceReady", _ => this.start());

#14

I’m also having this issue. I open my app and just see my background color. It works in the browser on both my desktop and mobile. The only plugin I’m using is sqlite


#15

even in 2018, the same issue persists. ionic cordova run broswer/android runs perfectly fine. but in DevApp my application bugs out completely