Build on Android - physicalSizeCategory not found
Closed this issue · 7 comments
When I create a new Alloy Project either via the terminal or with Titanium Studio 2.1.2 & the Alloy plugin, and attempt to run the project on Android I get an error with the ti.physicalsizecategory module.
The actual runtime error occurs on line 50 of the compiled alloy.js file (inside a try catch block I might add):
exports.isTablet = function() {
try {
var psc = require("ti.physicalSizeCategory");
return psc.physicalSizeCategory === "large" || psc.physicalSizeCategory === "xlarge";
} catch (e) {
return Ti.API.warn("Could not find ti.physicalSizeCategory module, using fallback for Alloy.isTablet"), isTabletFallback();
}
return isTabletFallback();
Specifically the line:
var psc = require("ti.physicalSizeCategory");
In the variables window, the psc variable is undefined (obviously as it never finishes this assignment). The Stack trace shows no helpful information.
I get the two following lines in the FastDev Process console:
[INFO] [2012-08-23 16:25:26,023] ti.physicalSizeCategory.js exists: false
[INFO] [2012-08-23 16:25:26,034] ti.physicalSizeCategory.js exists: false
I am new to Titanium development, so there might be something I am missing here, and have Googled this issue to try to find out what is going on but cannot seem to find anything out there.
I am pulling my hair out here - I don't understand where I can change this - or remove the module, I don't really need it to do the testing I want to do to determine if I should continue with Alloy or try something else.
Any help would be appreciated.
Couple of questions:
- What version of Alloy?
alloy --version
- What OS are you running on? OSX, Win, Linux?
- What version of the Titanium SDK are you building against?
- Do you have a
modules/android/ti.physicalsizecategory
directory in your project?
Oops sorry - I meant to post all of that info too...
Alloy Version: 0.2.12
OS: OSX 10.6.8
Titanium SDK: 2.1.1.GA (I think?)
Titanium Studio Build: 2.1.2.201208161207
The modules/android/ti.physicalsizecategory
directory exists - within it is a single directory 1.0
that contains some files and directories, including directories: documentation, examples, libs; and files (in the 1.0 directory): LICENSE, manifest, physicalsizecategory.jar, timodule.xml
Thanks for your rapid response.
I was coding around a tistudio bug, maybe it was resolved in the latest 2.1.2 build. I'll check in the morning.
I just went through all the steps to create a new project and test on Android and everything seems to work fine on my end. The only difference between your setup and mine is that I'm running OSX 10.7.4 (which I don't think is the issue) and I have a the latest version of the TiStudio beta, as well as the latest version of the alloy plugin.
Try updating to the latest beta of both TiStudio and the alloy plugin and see if you still have the same issues: http://preview.appcelerator.com/studio/
Thanks Tony. I updated TiStudio to the beta version 2.1.3 and also updated the Alloy Feature to 2.2.0.201208241458 - unfortunately this did not resolve the issue. The Titanium SDK is still 2.1.1.GA though - have I done something wrong with the update?
Does TiStudio Beta 2.1.3 come with an updated SDK?
I also tried starting a new project and just running it and I got exactly the same issue.
I did notice the following two lines in the console of the Android Emulator Process:
[WARN] Could not find Titanium Module id: ti.physicalsizecategory, version: 1.0, platform: android [WARN] Couldn't find app module: ti.physicalsizecategory
FastDev Process outputs that it cannot find ti.physicalSizeCategory.js - twice:
[INFO] [2012-08-27 08:49:24,800] ti.physicalSizeCategory.js exists: false [INFO] [2012-08-27 08:49:24,809] ti.physicalSizeCategory.js exists: false
Also, I am using the Google APIs Android 2.2 SDK as the default Android SDK on the WVGA854 Screen.
OK, I think I've exhausted the obvious things that might be wrong, and debugging this via github comments is probably not going to work. Are you available on skype or a google hangout where you can share your screen and we can talk through it?
@MatthewDaniels I was finally able to recreate the error you are having and was able to put in a fix for it. This repository is up to date with the fix, and alloy version 0.2.16 (available on npm) is also up to date. I'm going to close this ticket, but will re-open if you encounter this problem even with the new version of alloy.