Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1066] Windows, Android: Alloy build to device fails when spawning Alloy compile command

GitHub Issuen/a
Resolution Date2014-11-26T22:40:34.000+0000
Affected Version/sAlloy 1.4.0
Fix Version/sAlloy 1.5.0, Alloy 1.4.0
Labelsqe-3.3.0, qe-noTestNeeded
ReporterSamuel Dowse
AssigneeTim Poulsen



Android device builds will fail with Android SDK-Tools 23.0.1 installed. Attached the log file of the error from the CLI.

Steps To Reproduce

1. Install the Android SDK-Tools 23.0.1 and all the necessary components 2. Create an Alloy project 3. Build to device

Expected Result

App should install on device

Actual Result

Build throws and errors and fails to install on device
[ERROR] Failed to run command "build"
[ERROR] TypeError: Cannot call method 'on' of null
    at C:\Users\Tester\Documents\Appcelerator_Studio_Workspace\alloyAndroidProject\plugins\ti.alloy\hooks\alloy.js:132:18
This error is happening because the stdio is not inheriting properly from the parent Titanium CLI process. This could be a Node.js issue, but I doubt it.


I think we need to explicitly specify the stdio streams for the spawned process. Inheriting stdio does not appear to be working. In the long term, the Alloy compile command needs to be a first-class CLI hook that does not spawn the Alloy compile command. That will fix this permanently. +Extra Information+ This only occurs on Windows.




  1. Tim Poulsen 2014-07-01

    PR: https://github.com/appcelerator/alloy/pull/468 The problem is not due to child process not inheriting stdio, but rather that child.stdout and child.stderr aren't valid objects in the case of a compile error. To get error output on Windows, I have to pass in the \{ stdio: 'inherit' \} options object and I have to test for the validity of the child properties before listening for the on data events. I've tested this fix on Windows using Node 0.10.26 and 0.10.29 as well as on OS X with Node 0.10.28. It works as intended on all. If you're testing with an existing project, you'll have to do ti clean or copy hooks/alloy.js to /plugins/ti.alloy/hooks/alloy.js.
  2. Tim Poulsen 2014-07-01

    I need to test with the Android R23 tools before considering this issue resolved.
  3. Tim Poulsen 2014-07-02

    Tested with Android R23 tools: the PR works as expected. The original issue is unrelated to Android tooling level.
  4. Tim Poulsen 2014-07-02

    PR merged to master and 1_4_X branches

JSON Source