Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova android emulator "cannot read property 'replace' of undefined"

Tags:

Have just installed the latest version of Apache Cordova (7.0.1) on Windows, the Android SDK, added the android platform, and when trying to run the android emulator it compiles everything ok but then shows a:

Cannot read property 'replace' of undefined

Without indication or anything else to trace the error.

like image 935
Adrián E Avatar asked Jun 21 '17 22:06

Adrián E


Video Answer


1 Answers

In the Ionic framework forum found the following answer that solved the problem:

Tracked it down to file /platforms/android/cordova/lib/emulator.js line 202:

var num = target.split('(API level ')1.replace(')', '');

Replace it with a regex search and extraction:

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

like image 189
Adrián E Avatar answered Sep 22 '22 18:09

Adrián E