Ionic cordova run android --livereload: Cordova not available


#1

When I run ionic cordova run android --livereload with my android device on the same wifi network as my laptop, the app loads fine. However, when I try to play native sounds or use the HTTP library from the native plugins, there is an alert that is issued that says “Cordova not available”. I am not sure why this is. How can I run the live-reload with native plugins?


#2

I have the same problem: frown: I think it happens when the cli ion is updated, maybe with a downgrade it can work.


#3

Yeah the problem showed up after the most recent update. I ran the ionic cordova doctor command which recommended the updates.


#4

Did you solve it?

I found this:


#5

No I have not. Hm, not sure if that link helps.


#6

well, while someone solves the problem, you can try to update this file

issue2

It was exactly like the description in the link above

Works for me, I hope this will help


#7

Thanks, but this works once, after reload i still having the same error plugin_not_installed, please provide us a solution.

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.7
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    ios-deploy : 1.9.1 
    ios-sim    : 5.0.8 
    Node       : v9.2.1
    npm        : 3.10.10 
    OS         : macOS High Sierra
    Xcode      : Xcode 9.2 Build version 9C40b 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : legacy

#8

Same issue here after upgrading to Cordova tools 8.0.

Currently builds and run without Live Reload option, however adding --livereload causes the emulator to not load plugins because it’s missing Cordova

cli packages: (xxx\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.7
Cordova Platforms  : android 7.0.0                                                                                      Ionic Framework    : ionic-angular 3.9.2

System:
Android SDK Tools : 26.1.1
Node : v6.11.4
npm : 5.4.2
OS : Windows 10

Environment Variables:

ANDROID_HOME : C:\Android\sdk

Misc:

backend : legacy

#9

Same error here. Last versions of all. Any update?


#10

+1 here since I upgraded Ionic CLI and Cordova and Platforms, so I don’t know where os the origin of the problem


#11

Same problem here :

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.6-201712271536
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.1-201711081842

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2
    ios-sim           : 6.1.2
    Node              : v8.1.0
    npm               : 3.10.10
    OS                : macOS Sierra
    Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : /Users/dev/Library/Android/sdk

Misc:

    backend : pro```

#12

@Executor00 thanks a lot, you saved my day. Even if it’s a temporary solution :slight_smile:
So inside node_modules/@ionic/app-scripts/dist/dev-server/serve-config.js :

exports.ANDROID_PLATFORM_PATH = path.join(‘platforms’, ‘android’, ‘app’, ‘src’, ‘main’, ‘assets’, ‘www’);

instead of

exports.ANDROID_PLATFORM_PATH = path.join(‘platforms’, ‘android’, ‘assets’, ‘www’);

:hugs:


#13

Hello @Behra!

Your solution not solve in my case. :disappointed_relieved:

I try editing this file and removing/adding android (platform) but the problem persists. Without --livereload my app performs beautifully, but, with this, completly broken.


#14

I find an similar solution:

  • Edit file node_modules/@ionic/app-scripts/dist/dev-server/serve-config.js and change last line to:
exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'app/src/main', 'assets', 'www');

This works for me!


#15

@stenioanibal This works for me, thanks!


#16

Man THANKS!
Got stuck 2 days with this issue, finally a solution.
Cheers!


#17

I can confirm this works for me too

  • Edit file node_modules/@ionic/app-scripts/dist/dev-server/serve-config.js and change last line to:

exports.ANDROID_PLATFORM_PATH = path.join('platforms', 'android', 'app/src/main', 'assets','www');

cli packages:

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

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:

    Android SDK Tools : 26.1.1
    Node              : v10.0.0
    npm               : 5.6.0 
    OS                : Linux 4.4


#18

Your app-scripts are out of date. The latest release is 3.1.9. Update them by running npm install @ionic/app-scripts@latest --save-dev. This should solve the problem without editing the scripts.


#19

Did that and the app is now blank and in console:

LE: worked after ionic cordova platform rm android && ionic cordova platform add android
Oh, and before deleting the android platform I did a npm install -g cordova because I saw on their npm page some updates.

Thanks!


#21

NICE!

Updating the @ionic/app-scripts is the right answer. Thanks @aSchmelter.