czwartek, 3 marca 2016

A supplement for Titanium4j "Getting started"

Some time ago I have planned to write my own tutorial for getting started with Titanium4j, but... :-) Simply I haven't found enough spare time to do that. Today I had a thought that I could do at least a small step in this direction and share at least a piece of this bigger thing...
...that's how I came up with the idea to write this post - supplement for the official "Getting started".

First I would like to tell you why you should use Titanium4j.
As you probably already know, it is based on Apcellerator Titanium, an excellent and popular Cross-platform mobile app development solution for Java Script. Thanks to Titanium4j, you have now the Java API to build native mobile application which is/has:

  • native UI,
  • 99% WORA (Write Once Run Anywhere),
  • easy,
  • well documented (at least indirectly through the official JS specification),
  • very good portability: Android, iOS, Windows (WP8) and Blackberry,
  • still maintained, a new release is coming.

So it's really worth to try this technology! Here is the promised supplement.
The "Prerequisites" section of the official getting started is not widely described and I would like to add something from my side. I had a troubles on the beginning and I solved all the issues. Here is what I did to have it fully working!

Before you start your Titanium4j Java project, you need (one time) do the following steps.

  1. Install the Appcelerator Command Line Tools (CLI) according to the description here (step 1-3). It is not said there, but I also had to install Titanium CLI using the command: 

An important note! Please avoid installing nodejs from the package manager! If about Ubuntu/Mint Linux I mean: "sudo apt-get install nodejs" since you can get some issues later!

After I had some troubles with 'appc setup' I chose this method:

I didn't go for Node.js v5 to try first the lower one. It worked for me, so I kept it.
I'm not sure now whether npm is delivered with the nodejs above, because I installed it separately in the way as suggested here.

Finally these versions worked for me with Titanium SDK release 5.1.1.GA

node -v
  ⇒ v4.2.4

npm -v
  ⇒ 2.14.12

So now everything is almost ready. The next steps are pretty easy.

2. Please Download GWT SDK
3. An Android SDK and iOS SDK and other are also needed to use emulator. 

When you run the Titanium CLI tool for the first time, you will be nicely guided to configure the environment. You will also have to login to the Appcelerator platform (with your free account credentials).

That's it. Now you can start to follow the steps from getting started:

This is a really great technology! Have fun!