After update Cordova to v6.4.0 and Android platform to 6.0.0, my app don't work any more. I'm getting this:
deviceready has not fired after 5 seconds. cordova.js:1223
Channel not fired: onCordovaInfoReady cordova.js:1216
Channel not fired: onCordovaConnectionReady cordova.js:1216
I tried to remove all plugins and add it one by one. I found that is a problem with cordova-plugin-device and cordova-plugin-network-information. All my plugins are up to date
If you happen to be running the Crosswalk plugin in your app I just confirmed that uninstalling it and reinstalling via;
cordova plugin add https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview
Gets rid of
deviceready has not fired after 5 seconds. cordova.js:1223
Channel not fired: onCordovaInfoReady cordova.js:1216
Channel not fired: onCordovaConnectionReady cordova.js:1216
You can see the issue at Crosswalk's Jira issue listing here.
This should be fixed in cordova-android 6.1.0. It has not been added to the npm-registry yet, so you can use it by placing this to your config.xml:
<engine name="android" spec="https://github.com/apache/cordova-android.git#6.1.0"/>
Solution:
put the call "cordova.js" to the last line in the page.
<script type="text/javascript" src="cordova.js"></script>
</body>
</html>
Greeting...
I recently encountered this same issue on iOS. Eventually what worked for me was a simple remove and add of the ios platform:
cordova platform remove ios
cordova platform add ios
It had been quite a while since I had completely re-built the ios platform and, just like you, I had made other major changes during that time (Cordova upgrade, XCode upgrade, etc). My theory is that my config.xml or existing ios build was somehow incompliant with the latest Cordova requirements. Doing a platform remove and platform add will clear out the build files and update config.xml.
I doubt this applies to the OP, but for others who've encountered this same issue, please ensure that you've included cordova.js in your index.html file. If you've not done so, add this line:
<script src="cordova.js"></script>
It's a very common omission when just getting started with Cordova.
For someeone (like me) who would not like to downgrade Cordova, please follow my guide (I successfully did after a whole day trying):
- Back up your current (cordova root, not platforms/android) project.
Open cordova CLI from root:
cordova platform remove androidAfter removing:
cordova platform add android. Your package project (structure) folders are kept, so don't worry.cordova plugin lsand then remove every cordova plugin execpt Notfication and Whitelist (Cordova's default installed plugins).- Use
cordova plugin add <plugin-id>to add back your using plugins one by one. Go back to you backup-ed folder: Clone back
AndroidManifest.xmland everything inapp/src/main. This includes: assets, java, libs and res. One file you only need (actually I suggest) to leave out is res/xml/config.xml. Do not clone this. Let Cordova build later.Cordova CLI (from root cordova project, not platforms/android):
cordova build android- If you have any 3rd party plugins, or using different content src, properties, please copy them (features, content src, author,...) back into
app/src/main/res/xml/config.xml. Cordova won't be able to detect your 3rd plugin - Open Android Studio, import your "repaired" project --> Make project, then Run App. Enjoy!
Make sure you included cordova.js on the bottom of the body of your index.html
And don't ever forget about the type="text/javascript" that must be located before src=""
<!DOCTYPE html>
<html>
<head></head>
<body>
...
<script type="text/javascript" src="cordova.js"></script>
</body>
</html>
Also include this meta tags on the html head
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Then remove the current installed platform and then add it again
cordova platform remove android
cordova platform remove browser
cordova platform remove ios
cordova platform add android
cordova platform add browser
cordova platform add ios
Serve it then refresh your browser or build it
If that doesn't solve your problem, then try remove some plugin one by one or remove your scripts to find out the bugs..
I'm running Visual Studio and have this error in the Chrome emulator. I found that firing up the Web Inspector would allow Visual Studio to prompt for some of the hooks that various plugins were asking for, and clicking through the various popups got me past this. It must be something to do with the way that Visual Studio sets up the Cordova Plugin Simulation, but with my setup it was getting blocked from presenting the popups.
I dont know the real reason of this issue,
But I tried removing cordova-plugin-whitelist and cordova-plugin-device from the plugins list and added them again.
luckily that solved the issue,
来源:https://stackoverflow.com/questions/40352905/android-deviceready-has-not-fired-after-5-seconds