2011/05/03
Android & iPhone 共通開発環境 Titanium を試してみた。
知人から Android の開発環境なら Titanium って言うのが有るよ、
と教えてもらったのでちょっと調べてみた。
Titanium は HTML+JavaScript で記述したソースを
Android と iPhone
の両方のバイナリにコンパイルする事ができる結構凄いやつらしい。
この辺を参考に開発環境を作ってみた。
※VirtualBoxのNICの設定がNATだとうまく行かなかった。Bridgeにしたらうまく行った。 次に Android の開発環境をインストールする。
adb.exe は最近のバージョンで tools/ から platform-tool/ に 移動されているので1つ前のバージョンに戻したが 今度は package の update ができない。 いろいろ悩んだあげく GettingStart を良く読んだら書いてあった。
これ Titanium 側をちょこっと直せば済む話しなんじゃねーの?
絶対はまるだろ。 サンプルプログラムをインポートして実行するも途中でエラーになり失敗する。
根が深そうなので一旦、諦め新規作成したプロジェクトを実行してみる。
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var label1 = .createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win1.add(label1);
//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win2.add(label2);
//
// add tabs
//
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
Titanium.UI の API を理解すればそれなりにアプリが作れそうな
感じではある。
但し、この環境ではソース修正からエミュレータに画面が現れるまで 1分くらいかかってしまうので実際の開発に使うのはかなり厳しそう。
- http://www.atmarkit.co.jp/fsmart/articles/titanium01/01.html
- http://code.google.com/p/titanium-mobile-doc-ja/
- http://developer.appcelerator.com/
- http://wiki.appcelerator.org/display/guides/Getting+Started+with+Titanium
※VirtualBoxのNICの設定がNATだとうまく行かなかった。Bridgeにしたらうまく行った。 次に Android の開発環境をインストールする。
- http://developer.android.com/sdk/index.html
adb.exe は最近のバージョンで tools/ から platform-tool/ に 移動されているので1つ前のバージョンに戻したが 今度は package の update ができない。 いろいろ悩んだあげく GettingStart を良く読んだら書いてあった。
Titanium Developer expects the adb executable to be in the same location, ie $ANDROID_SDK/tools, as the Android SDK and AVD Manager (android executable), but Google has recently moved it to $ANDROID_SDK/platform-tools. Thus, it is necessary to create a symbolic link in $ANDROID_SDK/tools that references the new location. For Linux, create the symbolic link as follows: For Windows, you must create a symbolic link for adb.exe and its associated AdbWinApi.dll:adb.exe と DLL を tools/ にコピーしたらあっさり解決。
これ Titanium 側をちょこっと直せば済む話しなんじゃねーの?
絶対はまるだろ。 サンプルプログラムをインポートして実行するも途中でエラーになり失敗する。
根が深そうなので一旦、諦め新規作成したプロジェクトを実行してみる。
- ProjectType を Mobile にする。
- AppId はドットを含むパッケージ名になっていないとコンパイル時におかしくなる。 参考:http://d.hatena.ne.jp/siso9to/20110404/1301933484
- Name,Dir,URLは適当に。
但し、この環境ではソース修正からエミュレータに画面が現れるまで 1分くらいかかってしまうので実際の開発に使うのはかなり厳しそう。
この投稿へのコメント

コメント・フォーム