Tag – Appcelerator


  • posted by mark
  • on Jan. 22, 2014
(If you're just looking for the problems and solutions, and not the rant, skip to the bottom) Yesterday was an absolute write off. It was a write off because of my old friend Titanium Appcelerator. Regular readers of this site will know that I have a bit of a love / hate relationship with this product. For the uninitiated, Titanium Appcelerator is a cross platform IDE and toolset that allows for the development of mobile applications using Javascript, and builds for Android, iOS, Blackberry, Tizen and more. It's like PhoneGap, but advertises itself as compiling and optimizing the code so it's much closer to native development when it comes to performance. It does show, in our experience, aside from an initial delay starting up, the Appcelerator apps run a lot faster than PhoneGap ones. It's why we adopted it as our development platform of choice for clients looking for cross platform mobile and tablet applications, where budget, time or support constraints might not allow for native development, or where the client is looking to only maintain and develop everything from a single source. But it's not without it's problems, which takes me back around nicely to my original point. In the middle of last year I switched my primary development environment to Windows 8 in an attempt to give the platform another chance, having previously conducted the bulk of my work under Ubuntu Linux. After a few months of constant problems and workarounds, I was forced to switch back, and in doing so needed to update my development environment with the latest bits and pieces --- which broke my installation of Titanium Appcelerator. Problem 1 - The required installation of Node.js This is one area where Windows surprisingly won. When prompted with the update box for version 3+ of Appcelerator, Node.js was installed at the same time. Not so on Linux. To be fair, the Appcelerator site says this, and offers a guide at http://docs.appcelerator.com/titanium/latest/#!/guide/Installing_Node. The problem is that I followed the advice on there to set npm to use my home directory (or rather a directory inside my home directory), updated my environment path accordingly, and installed npm and nodejs via apt-get. I then tried via the IDE, and it didn't detect Node.js, trying to install it again. I won't bore you with everything I tried (including going through the command line), but safe to say after a lot of googling the issue but not finding a solution, it was solved by uninstalling npm and nodejs completely, stripping npm of it's installed packages and forcing the npm directory back to /usr/local (I even had to override this with the .npmrc file in my home directory since it insisted on picking up my old prefix even when it was removed). So with my prefix set to /usr/local I did: sudo apt-get install npm nodejs nodejs-legacy sudo npm install -g titanium titanium login .. and entered my login details titanium sdk install titanium setup .. and then stepped through the quick setup. During the initial attempts at this I ran in to .. Problem 2 "/usr/bin/env: node: No such file or directory" and "[ERROR] "/usr/bin/titanium" is an unrecognized command" After some googling on this one, I discovered that the former appeared because of a naming convention issue on ubuntu between node / nodejs. The answer here is to install the nodejs-legacy package. The latter issue is caused by this bug http://developer.appcelerator.com/question/160741, and the solution I used to get around it was to use Julien Vanier's fork as suggested in his comment: sudo npm install -g git://github.com/monkbroc/titanium.git .. and I'll switch back when they've fixed it. Problem 3 Android SDKs not found This one literally had be clawing at the walls. I have the Android SDK installed to /opt/share/android-sdks. Loading up the previous version of Appcelerator, it was just a matter of pointing this to the right directory, it would tell me what wasn't installed and using the link on the Dashboard I could invoke the android package manager and install what was missing. Not so now. It appears they've replaced it with a wizard which attempts to install the correct packages for you. So I provided my directory and it presented me with a series of checkboxes for what versions to install, then went ahead and downloaded them over the ones that were already installed. At the end of it, it complained that Android Platform 5.0 was required. Again, lots of frustration on this one, but eventually I got it solved by: - Ensuring that my Android tools and platform tools were on the path. - Invoking the Android package manager on the command line (android) and installing API 19, 14, 11, 10, 8 and 5 (you have to make sure Obsolete is selected for this) - Running "titanium setup" on the command line, then using the android setup to point it at this directory. Finally running a check after and it showed up. Well that's the end of my rant, hopefully the above will help anyone else who runs into the same issues as I did. I haven't decided to drop Appcelerator just yet as despite the negative tone of this post, it really is a great system to develop on and a massive time saver -- when it's working.
  • posted by mark
  • on July 2, 2013
We recently ran into an error with Titanium Appcelerator where an app built for Android would work fine when using a development version, but when packaged for release it failed to install on an actual device, simply failing with the message "Application not installed". What became even more puzzling is that the error appeared when the apk file was packaged on 2 machines, but when we built it on a third it worked. The difference? Java 7, specifically jarsigner. The first two machines had JDK 7 installed, but the third was still running 6. After some research, it turns out that the default algorithm jarsigner uses has changed between these versions, and Android has trouble reading it. The fix To fix this, you need to do one of two things. Either downgrade to using JDK 6, or if you have to stay with 7, you can make some modifications to the Android builder script. The path to this differs depending on the operating system and version of Titanium SDK you're using. We encountered the issue in 3.1.0, and found the build files at (replacing User for your current user name): Windows: C:\Users\User\AppData\Roaming\Titanium\mobilesdk\win32\3.1.0.GA\android\builder.py Linux: ~/.titanium/mobilesdk/linux/3.1.0.GA/android/builder.py These lines might be different depending on your version, but in 3.1.0 you need to comment out most of the get_sigalg() function defined at line 1719, like so: def get_sigalg(self): #output = run.run([self.keytool, # '-v', # '-list', # '-keystore', self.keystore, # '-storepass', self.keystore_pass, # '-alias', self.keystore_alias #], protect_arg_positions=(6,)) # If the keytool encounters an error, that means some of the provided # keychain info is invalid and we should bail anyway #run.check_output_for_error(output, r'RuntimeException: (.*)', True) #run.check_output_for_error(output, r'^keytool: (.*)', True) #match = re.search(r'Signature algorithm name: (.*)', output) #if match is not None: # return match.group(1) # Return the default: return "MD5withRSA" We also had a problem on Windows after making this change where the later delete and rename step after zipalign is run would fail (reporting an exception at line 1851 on os.rename stating the file already existed). This was solved with a timeout (line 1850): os.remove(app_apk) time.sleep(10) os.rename(app_apk+'z',app_apk)
  • posted by mark
  • on Nov. 15, 2012
During the recent development of an Android application using Titanium Appcelerator, we needed to bring in support for AdMob. Fortunately there's modules out there to make this easy (the ones I used can be found at https://github.com/appcelerator/titanium_modules), but unfortunately after importing this module into our project, I hit a major stumbling block on my development platform (Xubuntu Linux). On building the app I got clobbered with this message: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize'). After Googling around for a while chasing this error, I found many posts suggesting that all we needed to do was add this line to the entry in our tiapp.xml manifest: <tool-api-level>14</tool-api-level> However that just resulted in another error being thrown out: [ERROR] Application Installer abnormal process termination. Process exit value was 1 To solve this I had to dig around in the Titanium configuration, and it turns out the issue (on Linux) at least is that the build script used by titanium, 'androidsdk.py' doesn't contain support for versions of the Android SDK over 11 (android-3.0). So if anyone else has hit this issue, all you need to do is modify this file (which at the time of writing I found in ~/.titanium/mobilesdk/linux/2.1.4.GA/android/androidsdk.py but you may need to adjust depending on your version) and change the android_api_levels declaration to read: android_api_levels = { 3: 'android-1.5', 4: 'android-1.6', 5: 'android-2.0', 6: 'android-2.0.1', 7: 'android-2.1', 8: 'android-2.2', 9: 'android-2.3', 10: 'android-2.3.3', 11: 'android-3.0', 12: 'android-3.1', 13: 'android-3.2', 14: 'android-4.0', 15: 'android-4.0.3', 16: 'android-4.1.2', 17: 'android-4.2', } And hey presto, it worked!