Why do I get this error when trying to run my Cordova application in Android? -


i downloaded , added "nexus 5x api 26" "your virtual devices" in android studio, cordova has @ least 1 possible target run in.

however, when run command

cordova run android 

the terminal (after other lines) responds:

build successful  total time: 1.305 secs built following apk(s):      /users/karel/cordova projects/demo/platforms/android/build/outputs/apk/android-debug.apk android_home=/users/karel/library/android/sdk java_home=/library/java/javavirtualmachines/jdk1.8.0_144.jdk/contents/home no target specified , no devices found, deploying emulator error: cannot read property 'replace' of undefined 

the emulator runs fine when run application in android studio, not when using cordova run command - work other platforms.

if can me, appreciated!

try target api 25 instead of 26.

problem , fix reported here: https://forum.ionicframework.com/t/error-cannot-read-property-replace-of-undefined-android/93297/31

in file /platforms/android/cordova/lib/emulator.js line 202:

var num = target.split('(api level ')[1].replace(')', ''); 

you need replaced regex search , extraction:

var num = target.match(/\d+/)[0]; 

because target android api 26 , trying parse this:

var num = target.split('(api level ')[1].replace(')', '') 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -