Tuesday, May 21, 2013

Mobile - Titanium Appcelerator Quick Start Tutorial

  Downloading and Installing Titanium Studio

Now, we are ready to install Titanium Studio, the Integrated Development Environment (IDE), used to create, manage, develop, debug and deploy Titanium applications.
To download and use Titanium Studio, a valid Appcelerator Network account is required. You may get one via the Sign Up page.
Download the installer from http://my.appcelerator.com. For Mac OS X and Windows systems, run the installer program. For Linux systems, unpack the ZIP file.

Launching Titanium Studio

When you launch Titanium Studio for the first time, login with your Appcelerator Network username and password. Select a workspace, which is simply a folder where Titanium Studio places all of the project files and IDE preferences data.
images/download/attachments/29004949/01-Workspace-Launcher.png
When Studio launches for the first time, it automatically starts installing the latest Titanium SDKs and additional Titanium command-line tools. Once this is complete, confirm that no further updates are pending and that Studio is at the latest version.
  • Run Help > Check for Updates to ensure that the latest version of Titanium Studio is installed.
  • Run Help > Check for Titanium SDK Updates to ensure that all the official Titanium SDK releases are installed.
  • Repeat these two steps until there are no more updates available.
images/download/attachments/29004949/03-Titanium-Studio-Software-and-SDK-Updates.png

Configuring Titanium Studio

If the Titanium Studio Dashboard is not already open, click the toolbar button with the Appcelerator logo, click the dashboard Get Started tab, then click the Let's get things set up! button that appears.
images/download/attachments/29004949/04-Titanium-Studio-Wizard-Configure-Tab-1.png
Since Titanium enables the development of native mobile applications with a vast array of native built-in functionality, we require the native tool chains to be installed for each of the mobile platforms that you will be targeting. Click each of the platform icons and follow the instructions to install and configure the respective native SDKs.
images/download/attachments/29004949/05-Titanium-Studio-Wizard-Configure-Tab-2.png

Installing Xcode and the iOS SDK

Note that to develop iOS applications for Apple devices, such as the iPhone and iPad, you will need to have an iOS developer account. The account is free but to run on device you will need to sign up for the iOS Developer Program costing $99/year. Be aware of Apple's license terms, which prohibit the building and execution of iOS applications on anything other than Apple hardware.
After clicking the Titanium Studio Dashboard iOS icon, follow the on-screen instructions to download Xcode and install the resulting software image file.

Selecting the Active Xcode Version

For systems with multiple Xcode versions installed, the current version can be selected by running sudo xcode-select at the command-line. For Xcode 4.2.x installed in the default location, run the following command:sudo xcode-select -switch /Developer/
For Xcode 4.3.x or later installed in the default location, run the following command:sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
Refer to the Titanium Compatibility Matrix for the versions of Xcode currently supported by Titanium.

Installing the Android SDK

After clicking the Titanium Studio Dashboard Android icon, follow the on-screen instructions to download and install the Android SDK.
  • When the Android SDK installer starts, set the destination directory.
images/download/attachments/29004949/10-Titanium-Studio-Wizard-Configure-Tab-Android-Path-5.png
The Android SDK Manager presents a list of package categories.
  • Select those supported by the latest official Titanium SDK, as described in the Titanium Compatibility Matrix.
  • Ensure that the required packages for the latest official Titanium SDK are selected.
  • To reduce install time, expand each category and de-select unnecessary components, such as Documentation, Samples and Sources.
  • Click the Install x packages button.
images/download/attachments/29004949/14-Android-SDK-Manager.png

Default Android SDK

If you intend to develop for Android, ensure that the default Android SDK is correctly set to a SDK supported by the Titanium SDK you will be using most. All applications use this SDK when they are first launched. Open the Preferences dialog.
  • On Mac OS X, from the menu bar, select Titanium Studio > Preferences.
  • On Windows and Linux, from the menu bar, select Window > Preferences.
On Studio 3.1.0 and later, in the Preferences dialog, navigate to Titanium Studio > Platform > Android SDK, then select a Google APIs item from the Default Android SDK drop-down menu.
On Studio 3.0.x and earlier, in the Preferences dialog, navigate to Titanium Studio > Titanium, then under the Android section, select a Google APIs item from the Default Android SDK drop-down menu.

Your First Mobile App

Now it is time to create an app!
Return to the Titanium Studio dashboard to start a new mobile project. Choose the Develop tab, and click on the New Project button of the Single Window Application template.
images/download/attachments/29004949/1-Quick-Start-Create-New-Project.png
Next, configure the project settings, including the project name, application identifier (app id) and your website URL.
  • Project name: this will become your app's name as seen by users, so choose wisely.
  • App Id: Titanium's version of the Android Package Name or CF Bundle Identifier. It is important to enter the name in reverse domain name format, with your app's name at the end, for example, com.example.myFirstApp. Avoid spaces and special characters.
  • Company/Personal URL: enter in the form, http://example.com.
images/download/attachments/29004949/2-Quick-Start-Set-App-id.png
Click Finish button. A project is created and opened. Notice the features that you will be using often with Titanium Studio.
images/download/attachments/29004949/3-Quick-Start-Studio-Interface.png
The project filesystem layout is always the same.
  • Resources folder: your project's code files and graphics are stored in this folder.
  • app.js: your project's bootstrap file. Every project has one; it's the file loaded first when your app is launched.
  • tiapp.xml: the details you enter in the new project wizard are used to populate the tiapp.xml file.
Those are essentially the only required files, but you can create others to produce a manageable and scalable code base. For example, you could put all your graphics in the Resources directory, or you could put them into subfolders. We will dig more deeply into cross-platform development in the rest of our documentation, but the android and iphone directories within Resources are locations for your platform-specific assets.
images/download/attachments/29004949/4-Quick-Start-Filesystem-Layout.png

Running Your App

To build and run your app, click the Run button as shown in the following screenshot, and choose the appropriate target.
images/download/attachments/29004949/5-Quick-Start-Launch-App.png
Your app should now be running in the mobile simulation environments you selected.
iOS
Android
images/download/attachments/29004949/7-Quick-Start-iOS-Simulator.png
images/download/attachments/29004949/6-Quick-Start-Android-Emulator.png

Troubleshooting

If you are experiencing problems after following these setup instructions, please follow the more detailed Setting up Titanium Studio guide.

Next Steps

Congratulations! You've just created and ran your first Titanium application. If you enjoyed it, try importing one of the sample projects as explained in Creating Your First Titanium Apps.
Work through the considerable free educational material available via the Titanium Studio "Learn" tab, which includes videos, tutorials, API documentation and even a Titanium book.
images/download/attachments/29004949/Dashboard-Learn.png
Thanks for checking out Titanium. We wish you the best of luck with building successful applications.

Sample Appcelerator

http://mobile.tutsplus.com/category/tutorials/appcelerator/




 
Reference:
https://developer.appcelerator.com/question/150963/failed-to-load-the-jni-shared-library-jvmdll
http://developer.appcelerator.com/question/120247/titanium-studio-error-launch-failed-to-create-java-virtual-machine
https://developer.appcelerator.com/question/152497/titanium-sdk-310-error-typeerror-argument-of-type-nonetype-is-not-iterable-on-building-android-app
http://developer.appcelerator.com/question/89531/failure-installfailedmissingsharedlibrary-on-new-kitchensink-android-why

0 comments:

Post a Comment