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

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

GitHub user filmaj opened a pull request:

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

    CB-12546: More robust support spawning the emulator with newer Android SDK

    <!--
    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
    
    Android
    
    ### What does this PR do?
    
    Two things related to starting emulator:
    
    1. Adds more versatile support for the changing structure of the Android 
SDK. In particular, if spawning the `android` command exits with a non-zero 
status code (as it does in SDK Tools 25.3.1), attempts to use `avdmanager` and 
massages its output to conform to the old output of `android list avd`.
    2. Ensures to spawn the emulator with a `cwd` parameter, to workaround the 
SDK bug described here: 
https://code.google.com/p/android/issues/detail?id=235461
    
    ### What testing has been done on this change?
    
    Not enough! Unfortunately, I cannot downgrade my Android SDK to test that 
this works on older SDK versions. Thus why I attempted not to change any of the 
old logic leveraging the `android` binary, and rather just built support for 
the new SDK on top of the old one, trying to use feature / failure detection 
along the way.
    
    ### Checklist
    - [X] [CB-12546](https://issues.apache.org/jira/browse/CB-12546)
    - [X] 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/filmaj/cordova-android CB-12546

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

    https://github.com/apache/cordova-android/pull/366.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 #366
    
----
commit 73f28541abf9bd372cb2a5402e2ac3b326c15b94
Author: filmaj <[email protected]>
Date:   2017-03-08T01:04:11Z

    CB-12546: start of work on parsing emulator info from `avdmanager` output. 
work in progress.

commit 8fc099b8f1b4f7bfb748eb6655d6cd1d0aa3dbdf
Author: filmaj <[email protected]>
Date:   2017-03-08T17:12:44Z

    CB-12546: tweak parsing of `avdmanager` output to match the old output from 
`android list avd`. also explicitly set the CWD of the spawned emulator process 
to workaround a recent google android sdk bug.

----


> Latest Android SDK tools introduce bug w/ Android emulator
> ----------------------------------------------------------
>
>                 Key: CB-12546
>                 URL: https://issues.apache.org/jira/browse/CB-12546
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Android
>            Reporter: Filip Maj
>            Assignee: Filip Maj
>
> For details: https://code.google.com/p/android/issues/detail?id=235461
> A workaround is to change the current working directory to the directory 
> housing the {{emulator}} binary. E.g.:
> {noformat}
> ~ via ⬢ v6.9.4
> ➔ which emulator
> /Users/maj/sdks/android/tools/emulator
> ~ via ⬢ v6.9.4
> ➔ emulator -avd nexus5-5.1
> [140736778830784]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at 
> ../emulator/lib64/qt/lib
> Could not launch '../emulator/qemu/darwin-x86_64/qemu-system-x86_64': No such 
> file or directory
> ~ via ⬢ v6.9.4
> ➔ cd ~/sdks/android/tools
> sdks/android/tools via ⬢ v6.9.4
> ➔ ./emulator -avd nexus5-5.1
> emulator: WARNING: encryption is off
> Hax is enabled
> Hax ram_size 0x80000000
> HAX is working and emulator runs in fast virt mode.
> {noformat}
> Potential fix: tweak the {{cordova run --emulator}} command to change the 
> current working directory to be the location of the emulator binary. That 
> might be an easy fix, as cordova uses the {{superspawn}} node module to kick 
> off the {{emulator}} process. That module takes an optional {{cwd}} parameter.
> Let's also check for the existence of {{android}} vs. {{sdkmanager}} to fix 
> the listing of images based on SDK version.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to