ionic-team/ionic-cli

bug: deviceready has not fired after 5 seconds

Closed this issue ยท 40 comments

From @mccob on February 13, 2015 16:33

Type: bug

Platform: android 4.4 browser

With last stable versions of crosswalk, ionic and cordova, got "deviceready has not fired after 5 seconds" error
and Cordova API are unusable.

Crosswalk developer say to open bug on ionic tracker : https://crosswalk-project.org/jira/browse/XWALK-3345

Copied from original issue: ionic-team/ionic-framework#3108

This also happens to me with Lollipop. Today I added crosswalk and with it live reload doesn't work, after a git reset --hard HEAD (to remove crosswalk) everything works fine

ratt commented

This only appears to be an issue with --livereload. If i compile and run normally then everything works as expected. If i ionic run --livereload android then i keep getting

0 490982 log deviceready has not fired after 5 seconds.
1 490983 log Channel not fired: onFileSystemPathsReady
2 490984 log Channel not fired: onCordovaConnectionReady

Same here. ionic run android -l gives

cordova.js:1183 deviceready has not fired after 5 seconds.
cordova.js:1176 Channel not fired: onFileSystemPathsReady
cordova.js:1176 Channel not fired: onCordovaConnectionReady

OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.2 LTS
Node Version: v0.10.35
Cordova CLI: 4.3.0
Ionic CLI Version: 1.3.18

@ratt can confirm this aswell

@ratt same here. Without --livereload works fine, with it - not

I have the same issue.

I install both two plugin below:
cordova plugin add https://github.com/wymsee/cordova-HTTP.git
cordova plugin add org.apache.cordova.file

it appears:
cordova.js:1183 deviceready has not fired after 5 seconds.
cordova.js:1176 Channel not fired: onFileSystemPathsReady

it works fine if I just install one of these two plugin.

maybe the cordova-HTTP use old version of org.apache.cordova.file and conflict with new version of org.apache.cordova.file

Take a look at this, it fixes the issue for me: http://christian.fei.ninja/Solution-to-PhoneGap-issue-device-ready-has-not-fired-after-5-seconds/

Sometimes the platforms and plugins get out of sync so this could resolve it.

Unfortunately @mlynch, I am unable to perform the 'add android' discussed in the linked article due to the following error:
Failed to install 'org.crosswalk.engine':CordovaError: Plugin doesn't support this projects cordova-android version. cordova-android: 3.6.4, failed version requirement: >=4.0.0-dev

'ionic start' includes android-cordova v.3.6.4 by default currently. Running 'cordova platform remove android' and then 'add android' as mentioned bombs due to the inclusion of crosswalk...

To get things back base level operational, you have to 'ionic remove browser crosswalk' before you can again run the 'cordova platform add android' without the above error...

Which of course takes us back to the initially reported problem.

I removed and re-added the plugins through cordova plugin remove / add and stopped getting this error message.

I am having this issue (sporadically) when I install cordova-plugin-file.

deviceready has not fired after 5 seconds.
cordova.js:1162 Channel not fired: onFileSystemPathsReady

PS: I am using Ripple and not the ionic-cli and I don't have Crosswalk but this is happening on the device and Chrome.

I tried removing and re-adding all the plugins as well as the latest versions of the file (2.0.0) and file-transfer (1.0.0) plugins but I am still getting the error.

ya mennnnaaaaaaaaaaaaaaaaaaaaaaa :D

I've run into this issue a few times because my livereload script was pointing to the wrong IP. Sometimes I had set the IP to a LAN address to test on a real device, and was still trying to use this IP for local development later once my IP changed. Using the correct IP prevents this issue.

I'm not sure where and why this error is occurring, However in my case issue resolved by removing platform using command
cordova platform remove android
cordova platform remove ios

and then adding them again.

I am also having this issue in ios
i build it in xcode 7 and tried it in simulator and device

I noticed things starts moving when I press the home button and comes out, 2nd time when i go inside app already loaded. anyone experiencing this ?

from my xcode error console ==>
[33174:1836465] deviceready has not fired after 5 seconds.
[33174:1836465] Channel not fired: onCordovaInfoReady
[33174:1836465] Channel not fired: onCordovaConnectionReady

$ionic info
Cordova CLI: 5.2.0
Ionic CLI Version: 1.6.4
Ionic App Lib Version: 0.3.8
ios-deploy version: 1.7.0
ios-sim version: 4.1.1
OS: Mac OS X Yosemite
Node Version: v0.12.7
Xcode version: Xcode 7.0 Build version 7A176x

ok. for me this got solved after modifying
<meta http-equiv="Content-Security-Policy" ....

@ituhin Thanks so much! I was stuck on the same issue where Xcode debugger's console seemed to stop after "Finished load of", and it would only resume after I swiped out of the app momentarily. The issue was that my Content-Security-Policy tag was too strict (initially set up for Android).

I had the same behavior. The security issue also caused Cordova plugin calls (like Camera and Imagepicker) to be delayed. They only triggered when swiping out (e.g. to adjust brightness) and then back into the iOS app.

๐Ÿ‘ :)

@ituhin / @growthclick would you please share what your meta tag looks like? I have this but it's not helping:

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

@siphiwe try removing this one if you have it
<meta http-equiv="Content-Security-Policy" ...

if you dont have it then your problem is something else. try safari/chrome remote debugger to figure out the issue.

I do need a Content-Security-Policy meta tag. It's required by the cordova-plugin-whitelist plugin. By the way, I had pasted the wrong tag in my previous comment, I just corrected it as follows:

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

For the record, if I do remove this tag, I still get the problem with deviceready not firing within 5 seconds. Chrome developer tools only reveals csrf problems which I'm ok with because localhost is trying to make requests to my server.

If the priority is iOS, then removing the Content-Security-Policy should solve the problem (you can still keep the Cordova-plugin-whitelist in place), and you can use Safari remote debugging to clarify other issues. For Android, the Content-Security-Policy seems to be required (for ionic run android), otherwise I was getting a white screen when trying to debug with "ionic run android".

Here is a Content-Security-Policy that I'm using on iOS (it's a google maps project). This version may not be tight enough security wise but it's working for me right now on iOS development.

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self'  http://*.googleapis.com
     https://*.googleapis.com http://*.gstatic.com https://*.gstatic.com
    'unsafe-inline'; script-src 'self'  http://*.googleapis.com
    https://*.googleapis.com http://*.gstatic.com https://*.gstatic.com 'unsafe-inline' 'unsafe-eval'">

The other thing to check for (with Cordova Whitelist) is that you specify access origin in your project's config.xml:

 <access origin="*"/>  

The above may not be secure enough for a production project - check out https://cordova.apache.org/docs/en/4.0.0/guide_appdev_whitelist_index.md.html for details.

Hope that helps!

I did face the same problem with device-motion plugin. When I remove it or stop calling it from the app it works without any problem

@siphiwe for me its this.... i had to add ws: and wss: for websockets in my app, and in ios it was crying for gap:
i have something like this
< meta http-equiv="Content-Security-Policy" content="default-src 'self' https:; connect-src 'self' wss://.xyz.com ws://.xyz.com https://.xyz.com https://.xyz.com ws://localhost:35729 gap:; style-src 'self' 'unsafe-inline' gap:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https: http: gap:; frame-src https://*.xyz.com gap: localhost" >

Thanks for assistance guys. I have tweaked the Content-Security-Policymeta tag and got no joy. I just noticed that this issue doesn't occur on IOS. Well, I'm testing with Intel XDK emulators. It's on Windows and Android emulators that I get this. Am a bit stumed at the moment.

For what it's worth, I have now trimmed the whole thing down to a brand new Ionic project (using the tabs template), and put $ionicPlatform.ready in the app.run method and this bug popped up. It's only on IOS that the problem does not happen. I have created this setup both on Ubuntu 14.4 and on Windows 7. Not sure if it's a version mismatch between Ionic itself and plugins, cordova, etc. (How do people manage version compatibility reliably, anyway? Is bower the preferred way to take care of this?)

Essentially, I can't do a simple "Hello world" with a platformReady event. No idea what to do now. Any assistance would be appreciated. Thanks

@siphiwe ... try with remote debugging in chrome. you might get more info regarding error

jayvi commented

Hi for everyone. I had the same problem and i just solve it :

  1. use yo ionic https://github.com/diegonetto/generator-ionic
  2. Choose blank project
  3. Copy - Paste my template folder with index.html and scripts
  4. sudo ionic platform ios
  5. sudo ionic build ios
  6. ionic emulate ios --livereload

and thats it.

I hope i help to someone with this.

Hey everyone. Often, the issue is a bad plugin install that is holding up
device ready. I find that what usually works is removing my other plugins
(ionic plugin rm cordova-plugin-statusbar for example), and adding them
back.

We are trying remove this error or be louder about it by going a bit deeper
in Cordova, but we're not there yet.

Max Lynch
Chief Executive Ion
max@ionic.io
414-530-9687


ionicframework.com | @Ionicframework http://twitter.com/ionicframework | 121
S. Pinckney st. Ste 300 Madison, WI 53703

On Thu, Oct 1, 2015 at 5:27 PM, jay notifications@github.com wrote:

Hi for everyone. I had the same problem and i jsut solve it :

  1. use yo ionic https://github.com/diegonetto/generator-ionic
  2. Choose blank project
  3. Copy - Paste my template folder with index.html and scripts
  4. sudo ionic platform ios
  5. sudo ionic build ios
  6. ionic emulate ios --livereload

and thats it.

I hope i help to someone with this.

โ€”
Reply to this email directly or view it on GitHub
#259 (comment).

Still same problem here...
I figured out that happend, to me, only the first time i open up the app. With no data nor cache.
On Android

For me, its definitely the Content-Security-Policy which was causing the issue in iOS. Yes, I do need the Content-Security-Policy to run for Android as well. So what I did as a work around was to have a bash script to inject the meta Content-Security-Policy tag into the index.html if I need it to build and run on Android and not to have it injected for build and running on iOS.

now I get this trouble, but how can I solve it, Who can tell me???thank a lot

cordova -version 6.2.0 with ionic -version 1.7.16

I too have this problem (only on some android devices), is there any update on this one?

My plugin are as follow

com.telerik.plugins.nativepagetransitions 0.6.5 "Native Page Transitions"
com.verso.cordova.clipboard 0.1.0 "Clipboard"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-crosswalk-webview 1.7.2 "Crosswalk WebView Engine"
cordova-plugin-customurlscheme 4.2.0 "Custom URL scheme"
cordova-plugin-facebook4 1.7.1 "Facebook Connect"
cordova-plugin-geolocation 2.2.0 "Geolocation"
cordova-plugin-inappbrowser 1.4.0 "InAppBrowser"
cordova-plugin-network-information 1.2.1 "Network Information"
cordova-plugin-social-message 0.4.0 "Social Message"
cordova-plugin-splashscreen 3.2.2 "Splashscreen"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-whitelist 1.2.2 "Whitelist"
cordova-plugin-x-socialsharing 5.1.3 "SocialSharing"
ionic-plugin-keyboard 2.2.1 "Keyboard"

I am using cordova 6.3.1

When you develop a hybrid application with PhoneGap, Cordova, Ionic, CordovaChromeApps and any other framework that is built on top on PhoneGap, I can almost assure you that youโ€™ll get this error. And itโ€™s super annoying.

I think the issue is when you delete your platforms folder, or the files inside, and do a platform add ... afterwards. This is at least how I reproduced it.

Youโ€™ll need to:

  1. add the platforms with cordova platform add ios android

  2. remove them with cordova platform remove ios android

  3. add them again.

I know this is super weird, but I think itโ€™s related to a faulty android.json and ios.json inside the platforms folder.

Following the steps above fixed the issue for me :).

Any Update on this issue ?, this seems to happen on some of the android devices as well still.
Ionic 2 RC 2 also having the same issue

Same problem for me with Ionic RC 3. Any Update? Please i need help

Same problem here (RC 3)

I'm going to lock this so people don't miss @bayanAbuawad's instructions above. 99% of the time the issue is a plugin that is in an inconsistent state. Try removing your plugins and your platforms and re adding them.