Note: for support questions, please use one of these channels:
https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/
I'm developing an application that uses SpeechRecognition and TextToSpeech plugins, when I build and install manually in my Android Device, that app works, but when I run "ionic cordova run android -lc --debug" on my prompt it shows me that cordova is not available.
I was expected to use native plugins with livereload
Steps to reproduce:
cli packages: (C:\Users\dayanfcosta\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Node : v8.9.3
npm : 5.6.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
Which @ionic/app-scripts version are you using?
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
The statcktrace is:
[20:48:36] console.warn: Native: tried calling SpeechRecognition.hasPermission, but Cordova is not available. Make sure
to include cordova.js or run in a device/simulator
My device is a Moto Z2 Play running android 7.1.1
Got the same issue this almost all of my nttive plugins when i use -livereload
@2f-concept I've found a solution searching on StackOverflow.
The solution is going to your node_modules/@ionic/app-scripts/dist/dev-server/serve-config.js
and replace exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'assets', 'www');
to exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'app', 'src', 'main', 'assets', 'www');
The StackOverflow solution's link is: https://stackoverflow.com/questions/40815183/ionic-2-cordova-is-not-available-make-sure-to-include-cordova-js-or-run-in-a-d/48266685#48266685
@dayanfcosta Big thanks to you ! it works fine for me
Most helpful comment
@2f-concept I've found a solution searching on StackOverflow.
The solution is going to your node_modules/@ionic/app-scripts/dist/dev-server/serve-config.js
and replace
exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'assets', 'www');to
exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'app', 'src', 'main', 'assets', 'www');The StackOverflow solution's link is: https://stackoverflow.com/questions/40815183/ionic-2-cordova-is-not-available-make-sure-to-include-cordova-js-or-run-in-a-d/48266685#48266685