ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

Cordova not available when using livereload on CLI 3.19.1 on Android Emulator

Open prasanthnv opened this issue 8 years ago • 4 comments

cli packages: (/usr/local/lib/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 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Node  : v9.4.0
npm   : 5.6.0 
OS    : macOS High Sierra
Xcode : Xcode 9.2 Build version 9C40b 

Environment Variables:

ANDROID_HOME : Users/prasanthvenugopal/Library/Android/sdk

Misc:

backend: pro
screen shot 2018-02-02 at 5 39 13 pm

Cordova not available in android emulator while live-reload turned ON. Cordova detected when running without live-reload. But in case of IOS, it works perfectly fine with live-reload.

prasanthnv avatar Feb 02 '18 12:02 prasanthnv

Replace in node_modules/@ionic/app-scripts/dist/dev-server/serve-config.js:

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

to

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

stanlleyramalho avatar Feb 16 '18 15:02 stanlleyramalho

Thanks for posting the issue! This is actually a duplicate issue of https://github.com/ionic-team/ionic-app-scripts/issues/1380

imhoffd avatar Feb 21 '18 23:02 imhoffd

I downgraded android platform version to 6+ and it works fine.

prasanthnv avatar Feb 28 '18 09:02 prasanthnv

Hello! Before days ago i had this problem and, most solutions not works for me, including @stanlleyramalho solution. After tests and searchs, i finded another similar solution and this works for me!

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');

In bad case, run ionic cordova platform remove android and add again.

I expect this works for you!

stenioanibal avatar Apr 11 '18 11:04 stenioanibal