ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.08k stars 13.51k forks source link

Newly created ionic app results in a "Cordova is not available" error (only with live reload) #9360

Closed itslenny closed 7 years ago

itslenny commented 7 years ago

Ionic version: (check one with "x") [ ] 1.x [x] 2.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:

Getting a cordova not available error with a brand new app running in the android emulator.

Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

Expected behavior: Cordova to "just work" when a new ionic app is created.

Steps to reproduce:

ionic start ionic2_test --v2
ionic platform add android
ionic emulate android -lcs

Related code:

insert any relevant code here

Other information:

Console output from chrome://inspect:


The devicemotion event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.

/Users/lenny/Junk/ionic2_test/node_modules/@angular/core/src/facade/lang.js:134 Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.

/Users/lenny/Junk/ionic2_test/node_modules/ionic-native/dist/esm/plugins/plugin.js:46 Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

/Users/lenny/Junk/ionic2_test/node_modules/ionic-native/dist/esm/plugins/plugin.js:46 Native: tried calling Splashscreen.hide, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

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

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: OS X El Capitan
Node Version: v5.11.1
Xcode version: Xcode 8.1 Build version 8B62
itslenny commented 7 years ago

Update

I've realized this only happens in live reload mode (with the -l flag). Everything seems fine without that. Maybe this is the intended behavior (although it's kinda annoying to need to have to totally restart the emulator for any change).

Is there any way to support live reload and have cordova be recognized?

If not this should at least be explained in the documentation.

jgw96 commented 7 years ago

Hello, thanks for opening an issue with us! I am going to close this issue as a duplicate of https://github.com/driftyco/ionic-app-scripts/issues/467.

oauthentik commented 6 years ago

Yes i have the same issue and i can confirm it's only working without live reloading option -l , i hope there is some fix soon :)

sublimator commented 6 years ago

@morfobin90

You on droid??

oauthentik commented 6 years ago

Yes :+1:

ionitron-bot[bot] commented 6 years ago

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.