tl;dr
It can’t currently be done (without some hackery and use of the titanium cli). Per this Jira Ticket, this is a known issue with Titanium modules, and is in the process of being resolved. The jira ticket has a fix version of “Release 3.3.0”, which it says is due in June, 2014. The comments in the Jira ticket describe some work arounds, if that’s your bag.
With Google’s release of the Chromecast SDK to the general public, I thought it would be a fun project to implement a titanium module that encapsulates it and exposes methods to allow chrome casting to work in a Titanium built application. Additionally, the Southeast Christian Church mobile app (also on iOS) streams sermon videos, and would be an ideal candidate for chrome casting abilities. So, I set out to achieve great things …
And then I came across the android documentation. There’s 3 days of my life I’ll never get back.
The Chromecast Developers Guide does provide step by step instructions, and links to a github repo with some great sample apps. The github repo also includes a Chrome Cast Companion Library (CCL) that provides a set of classes that make implementing the SDK even easier. The other sample apps use the CCL, so I figured I would as well
Skipping over to Titanium, I needed to reference the CCL in my titanium module, but the titanium docs weren’t very clear on that. Luckily, I found an appcelerator blog post that walks through the process, which is straight forward and pretty simple. In fact, it’s basically the same process that the android docs describe for a native project. Unfortunately, this method is to reference the libary’s .jar file, but I needed to use a project reference since the CCL provides resources as well as code (one of the many things I learned in the android documentation rabbit hole). Now I was stuck. Nowhere could I find any documentation about using a project reference in an android project.
I tried just using the library .jar file reference as described in the blog post. That worked at first (my code compiled!), but I got runtime errors about missing resource files (kinda saw that coming). Finally, after exhausing all other options, I asked the internet about it, and mentioned it to @appcelerator on twitter. Appcelerator’s dev relations guy then pointed me an Appcelerator Jira ticket documenting this very issue. The ticket has a workaround and there’s more workarounds in the comment section, but it’s scheduled to be resolved with the next titanium release in June 2014, so for now I’m just going to sit on it.