[ 
https://issues.apache.org/jira/browse/CB-12981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16082155#comment-16082155
 ] 

ASF GitHub Bot commented on CB-12981:
-------------------------------------

GitHub user AndyClausen opened a pull request:

    https://github.com/apache/cordova-android/pull/393

    Fix for Jira issue CB-12981

    https://issues.apache.org/jira/browse/CB-12981
    Using match with regex instead of split and replace
    
    <!--
    Please make sure the checklist boxes are all checked before submitting the 
PR. The checklist
    is intended as a quick reference, for complete details please see our 
Contributor Guidelines:
    
    http://cordova.apache.org/contribute/contribute_guidelines.html
    
    Thanks!
    -->
    
    ### Platforms affected
    
    
    ### What does this PR do?
    
    
    ### What testing has been done on this change?
    
    
    ### Checklist
    - [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
    - [ ] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform 
affected.
    - [ ] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/AndyClausen/cordova-android patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-android/pull/393.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #393
    
----
commit d22fd2b9ab8cec3619e923d3e0389d0f4577e561
Author: AndyClausen <[email protected]>
Date:   2017-07-11T12:46:56Z

    Fix for Jira issue CB-12981
    
    https://issues.apache.org/jira/browse/CB-12981
    Using match with regex instead of split and replace

----


> Error: Cannot read property ‘replace’ of undefined [Android]
> ------------------------------------------------------------
>
>                 Key: CB-12981
>                 URL: https://issues.apache.org/jira/browse/CB-12981
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-android
>    Affects Versions: [email protected]
>         Environment: OSX, Linux
>            Reporter: Birowsky
>
> Error happens when running `cordova run android` or `cordova emulate android`:
> Example output:
> {code}
> 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
> {code}
> 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
> {quote}
> I just came across the same problem. I tracked it down to file 
> /platforms/android/cordova/lib/emulator.js line 202:
> {code}var num = target.split('(API level ')[1].replace(')', '');{code}
> I replaced it with a regex search and extraction:
> {code}var num = target.match(/\d+/)[0];{code}
> {quote}
> Not sure if this is the right way to fix this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to