The one thing I discovered while using Titanium Mobile, is that trouble shooting is always a pain in the ass. Seriously, most errors don't make any sense, and are not really helping you get to your solution.
I had to figure it out the hard way unfortunately. But, I discovered a lot of solutions which will help you get through most of the problems, considering you didn't really made an error in your code.
So let me get it clear. Your code doesn't build, but you think you did it the right way? Let me help you.
First of all, remove the build. The build can be found here: "Titanium Workspace > Your Project > Build" and within that directory you'll find an android and/or an iPhone directory. Remove the contents of those directories (don't remove the directories themselves or you might get errors). Usually this method can be used when Titanium says it cannot find a module, and this error usually occurs when you did a build for a device (not emulator). When building for a device, Titanium strips away all unnecessary modules. So when you are using a module you haven't used before it will crash.
Secondly, if that didn't solve the problem, make sure your includes are working correctly. By default titanium should use the resources directory if you include like this:
|
1 | Ti.include('/myfile.js'); |
But mainly on android these kinds of includes could give errors. The best way to fix this is to use the resources path location. Which would make this line:
|
1 | Ti.include(Ti.Filesystem.resourcesDirectory+'myfile.js'); |
Note that I'm using Ti instead of Titanium. Ti is a synonym of Titanium and thus can be used like Titanium.
Next up, the error "File not found" in the debugging console in Titanium Studio. This error isn't really an issue of file not found, but it is an issue that there is an error in that file. Usually this is just a regular JavaScript error.
Should these fixes not fix your issue, let me know!