First of all we need to setup the development environment. See below requirements.
Prerequisites.
- Titanium studio with Android sdk
- Download the appropriate version of Android ndk from here http://developer.android.com/tools/sdk/ndk/index.html and extract it.
- Install Python 2.5 or above and set path for Python in Windows system variables http://www.python.org/getit/
- Install Eclipse jdt plugin for Titanium.
http://docs.appcelerator.com/titanium/latest/#!/guide/Installing_the_Java_Development_Tools
Note : Your Titanium work space name should not have spaces
Then lets see how to create the Android module using ide.
Open Titanium studio.
Select File >> New >> Mobile Module Project
Project name: Desired project name
Titanium SDK Version: Targeted version of Titanium SDK
Deployment target: Since this is Android module select Android
Click Next to edit Module Manifest File.
Enter
Version: Version of the module.
Author, License and description, etc.
At last click Finish to create the module.
After creating the module you can see src folder under project directory. By default there are two java classes ExampleProxy.java and Module.java
Open build.properties under the platform directory
Version: Version of the module.
Author, License and description, etc.
At last click Finish to create the module.
After creating the module you can see src folder under project directory. By default there are two java classes ExampleProxy.java and Module.java
By default that configures for the paths of
titanium.platform
android.platform
google.apis
titanium.platform=C:\\Users\\cpriyankara\\AppData\\Roaming\\Titanium\\mobilesdk\\win32\\3.1.1.GA\\android android.platform=C:\\SDK-Titanium\\sdk\\platforms\\android-10 google.apis=C:\\SDK-Titanium\\sdk\\add-ons\\addon-google_apis-google-10
You need to include path for Android ndk there. ie the location where you extracted the ndk archive. Add following line to build.properties
android.ndk = C:\\android_ndk\\android-ndk-r8e
Then right click on Build.xml and select Run As Ant Build
After complete the build process finally you should be able to see BUILD SUCCESSFUL message.
Then let's see how can we install created module in to Android Titanium project.
First of all Create new mobile project.(File >> New >> Mobile Project)
In next window select Classic from left side pane. Then select Default Project and click Next.
Fill Project name and app id fields. Select Android as Deployment target. Finally click Finish to create the project.
Next we need to install the created module in to our project. Open the module from project explorer. And open “dist” folder. In dist directory you can find the module in zipped and jar formats.
Add following lines after the </mobileweb> tag to add and register the module.
Here give same module version and module id as you provided when creating the module.
Then press ctrl + s to save the change to Tiapp.xml. And test run the project on emulator. Make sure that your project is running without any module related errors.Then let's see how can we install created module in to Android Titanium project.
First of all Create new mobile project.(File >> New >> Mobile Project)
In next window select Classic from left side pane. Then select Default Project and click Next.
Fill Project name and app id fields. Select Android as Deployment target. Finally click Finish to create the project.
Next we need to install the created module in to our project. Open the module from project explorer. And open “dist” folder. In dist directory you can find the module in zipped and jar formats.
Copy and paste the zipped archive to the root of
your newly created project.
Then open tiapp.xml in xml view
<modules> <module platform="android" version="1.0">com.my.module</module> </modules>
References:
http://docs.appcelerator.com/titanium/3.0/#!/guide/Android_Module_Development_Guide-section-29004945_AndroidModuleDevelopmentGuide-Overview
https://wiki.appcelerator.org/display/tis/Using+Titanium+Modules
No comments:
Post a Comment