-
Notifications
You must be signed in to change notification settings - Fork 667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cordova not available when running on android with the -l flag #3720
Comments
@Tochukwuibe Your dependencies look right to me. Which error do you see? I assume it's in the DevTools console of the device. |
@dwieeb yes, i see the warning that says, Cordova not available when I use chrome://inspect. this happens whenever i try to access any native features, I think the build server is either not adding or can't find Cordova js when you run on a native device using the -l flag. there was a similar issue like this in V3, the fix (hack) there was to go into the dist server folder under ionic in node modules and change the path to the Android platform, however, in v4 this doesn't work. |
In v4, we're not in total control of the livereload server (because it's running This code registers all the Cordova assets from a platform's |
@Tochukwuibe Can you verify that it's running |
@dwieeb right after i run the command "ionic cordova run android -l " the cli then runs the command "ng run app:ionic-cordova-serve --host=0.0.0.0 --port=8100 --platform=android" but no cordova.js is not present in index.html |
@dwieeb i just tried adding cordova.js manually with a script tag to the head in index.html but the debug console shows a 404 error for cordova.js |
@Tochukwuibe What are the contents of |
The folder structure is as follows @dwieeb -cordova-js-src/ |
@Tochukwuibe That also looks right. I'm stumped so far. Can I see your |
@dwieeb here it is "ionic-cordova-build": { |
@Tochukwuibe Oh, I'm sorry. I see what's wrong. |
@dwieeb feel free to share lol |
@Tochukwuibe It was a bug in the
|
yes, @dwieeb I can confirm that updating the @ionic/angular-toolkit package fixed the issue for me. Thank you |
Using `validateBuilderOptions()` is key--it fills in default values from the `schema.json` file. In this case, the new `cordovaAssets` option in the cordova-build Builder defaults to `true`, but if cordova-serve uses it without validating the options, the default is lost, resulting in "cordova not available" issues. fixes ionic-team/ionic-cli#3720
Bug Report
Ionic Info
Describe the Bug
Whenever I try to run my ionic app with live-reloading enabled on my Android device (ionic cordova run android -l), None of my plugins work, and I get the warning message, Cordova not available. If I run the same command without the -l flag it runs fine, but one can imagine how frustrating development can be without live reloading
Steps to Reproduce
Steps to reproduce the behavior:
Expected Behavior
Cordova should be available when running on a real native device
Additional Context
I am using nvm to manage different versions of Node on my machine.
The text was updated successfully, but these errors were encountered: