Description
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.
Solution
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.
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 copyI need to test with the Android R23 tools before considering this issue resolved.
Tested with Android R23 tools: the PR works as expected. The original issue is unrelated to Android tooling level.
PR merged to master and 1_4_X branches