Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
cordova@7.0.0
-
OSX, Linux
Description
Error happens when running `cordova run android` or `cordova emulate android`:
Example output:
BUILD SUCCESSFUL
Total time: 1.601 secs
Built the following apk(s):
/Users/Joanne/Desktop/learning/mobile/platforms/android/build/outputs/apk/android-debug.apk
ANDROID_HOME=/Users/Joanne/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
No target specified and no devices found, deploying to emulator
Error: Cannot read property 'replace' of undefined
More details, environment information of multiple people having this problem can be found here:
https://forum.ionicframework.com/t/error-cannot-read-property-replace-of-undefined-android/93297
A solution was also proposed here:
https://forum.ionicframework.com/t/error-cannot-read-property-replace-of-undefined-android/93297/11
I just came across the same problem. I tracked it down to file /platforms/android/cordova/lib/emulator.js line 202:
var num = target.split('(API level ')[1].replace(')', '');I replaced it with a regex search and extraction:
var num = target.match(/\d+/)[0];
Not sure if this is the right way to fix this.
Attachments
Issue Links
- Blocked
-
CB-13490 bug with ionic cordova emulate android
- Closed
- links to