Titanium fails to build or emulate android application

android, android-emulator, titanium, titanium-mobile

Solution

After hours of searching and seeking through too many similar problems without answers, I fixed it by myself. For everyone who is facing errors starting with `[ERROR] error: more than one emulator` in Titanium Studio, the problem can be because of one of the following reasons:

- You have an Android device connected to your computer

- You have an Android Simulator application like BlueStacks.

My error was because of BlueStacks running in background.

Problem

I just installed and configured Titanium Studio and it's dependencies to develop my Android applications but none of the applications even the sample app of titanium won't start in emulator. I can see `Mobile Web Preview` in browser but when I try `Android Emulator` I get the following error in Console: ``` [INFO] Force including all modules... [INFO] Compiling Javascript Resources ... [INFO] Compiling localization files [ERROR] error: more than one emulator [ERROR] Exception occured while building Android project: [ERROR] Traceback (most recent call last): [ERROR] File "C:\Users\Administrator\AppData\Roaming\Titanium\mobilesdk\win32\3.1.0.GA\android\builder.py", line 2528, in <module> [ERROR] builder.build_and_run(False, avd_id, debugger_host=debugger_host, profiler_host=profiler_host) [ERROR] File "C:\Users\Administrator\AppData\Roaming\Titanium\mobilesdk\win32\3.1.0.GA\android\builder.py", line 2285, in build_and_run [ERROR] self.push_deploy_json() [ERROR] File "C:\Users\Administrator\AppData\Roaming\Titanium\mobilesdk\win32\3.1.0.GA\android\builder.py", line 1954, in push_deploy_json [ERROR] sdcard_available = self.wait_for_sdcard() [ERROR] File "C:\Users\Administrator\AppData\Roaming\Titanium\mobilesdk\win32\3.1.0.GA\android\builder.py", line 1907, in wait_for_sdcard [ERROR] if 'SDCARD READY' in output: [ERROR] TypeError: argument of type 'NoneType' is not iterable [ERROR] : Build process exited with code 1 [ERROR] : Project failed to build after 33s 353ms ``` Android emulator opens up and everything looks find but my application fails to build. I found this page and did copy the compile command and manually run it like this: ``` python "c:\Users\Administrator\AppData\Roaming\npm\titanium.CMD" "--no-colors" "--no-prompt" "build" "--platform" "android" "--sdk" "3.1.0.GA" "--log-level" "trace" "--target" "emulator" "--android-sdk" "C:\Users\Administrator\Desktop\adt-bundle-windows-x86_64-20130219\sdk" "--avd-id" "2" "--avd-abi" "armeabi" "--avd-skin" "HVGA" "--skip-js-minify" ``` but python gives me this error: ``` File "c:\Users\Administrator\AppData\Roaming\npm\titanium.CMD", line 1 :: Created by npm, please don't edit manually. ^ SyntaxError: invalid syntax ``` What am I doing wrong? Where is the roblem? Additional Info: I'm using latest version of Titanium Studio (build: 3.1.0.201304151600) on my Windows Server 2008 R2; I have `node.js`, `npm`, `node.acs`, `python` installed on my system and environmental variables are correct and working; I have Android SDK for both `android-2.2` and `android-17` versions.

Original source