Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

livereload doesn't work with native plugins #1391

Closed
dayanfcosta opened this issue Feb 13, 2018 · 4 comments
Closed

livereload doesn't work with native plugins #1391

dayanfcosta opened this issue Feb 13, 2018 · 4 comments

Comments

@dayanfcosta
Copy link

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

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.

What behavior are you expecting?

I was expected to use native plugins with livereload

Steps to reproduce:

  1. Install plugin like SpeechRecognition
  2. Execute a SpeechRecognition.hasPermission() from your app
  3. Run app using "ionic cordova run android -lc --debug"
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

@2f-concept
Copy link

Got the same issue this almost all of my nttive plugins when i use -livereload

@dayanfcosta
Copy link
Author

@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

@2f-concept
Copy link

@dayanfcosta Big thanks to you ! it works fine for me

@imhoffd
Copy link
Contributor

imhoffd commented Feb 21, 2018

Related to #1380

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants