開発環境構築(on Ubuntu)

Last-modified: 2011-02-03 (木) 00:49:18

用意するもの

  • Ubuntu
  • JDK
  • Eclipse
  • Android Development Tools(Eclipse plug-in)
  • Android SDK
  • Android NDK

それぞれのバージョンに相性があるらしい。

Ubuntu

バージョンを確認する方法

$ cat /etc/lsb-release
DISTRIB ID=Ubuntu
DISTRIB RELEASE=10.04
DISTRIB CODENAME=Lucid
DISTRIB DISCRIPTION="Ubuntu 10.04.1 LTS"

JDK

$ sudo apt-get install opengdk-6-jdk

Eclipse

Ubuntu 10.04 でパッケージになっているEclipse は 3.5(Galileo)らしい。Eclipseの最新版は 3.6(Helios)のようだが、ひとまずこのバージョンで進めてみる。

エラーになった。orz

C/C++ 用で使う場合と Java/Android で使う場合があるので、この際、Ubuntu のデフォルトではなく、Ubuntu のパッケージ管理外で勝手に Eclipse をインストールする。幸い Eclipse は展開したディレクトリ内で閉じるので
複数バージョンインストールしても、パスの設定を切り替えるだけでよいはず。

Android 用には本家のまにゅあるどおり Eclipse Classic 3.6 Helios をインストールする。

Android SDK

ADT より先にインストールするよう、強く勧められている(ADTのページで)

SDKのファイルをダウンロードして展開する。<sdk>/tools にパスを通す。
具体的には、.bashrc に
export ANDROID_SDK=<sdk>/tools
export PATH=${PATH}:${ANDROID_SDK}
を追加する。

複数の Eclipse(C/C++用とJava用)を使い分けるため、シェルスクリプトでパスを使い分ける。

${HOME}/bin/eclipse_for_java.sh

$ cat ${HOME}/bin/eclipse_for_java.sh
#!/bin/bash
export ANDROID_SDK=(Android SDK install dir)
export PATH=${ANDROID_SDK}/tools:${NATIVE_PATH}
$(eclipse install dir)/eclipse

${NATIVE_PATH} は .bashrc であらかじめ定義しておく。

シェルスクリプトに実行権限を与える。

$ chmod +x ${HOME}/bin/eclipse_for_java.sh

Ubuntu なので、ランチャを作り、eclipse のアイコンを割り当てておく。

ADT(Android Development Tools)

普通にインストールすると

"org.eclipse.gef 0.0.0 required"

というエラーになる。ググった。

I thought that an IDE would be useful so I installed Eclipse 3.5.1
and tried to install the Android Development Tools, or ADT. However, an error
"org.eclipse.gef 0.0.0 required" (or something like that) appeared.
After googling for a while, I found a URL for the GEF SDK, which is
Eclipse's Graphic Editing Framework, as the following URL.
http://download.eclipse.org/tools/gef/updates/releases/
So I added this update into Eclipse by
  1. Go to the menu 'Help',
  2. Choose 'Install New Software',
  3. Place the GEF SDK updates URL into the box after 'Work with:',
  4. Choose the right version of updates in the box below (for me, GEF SDK 3.5.1),
  5. Click 'Next',
  6. After Eclipse calculates all the dependencies, just click 'Finish' and let it
     install the plugin.
After installing GEF SDK, return to installation of ADT. You should be able to install it now.

この対策でもうまくいかず。orz

なので、上述のように Ubuntu のパッケージの eclipse を使わず、Eclipse 3.6 classic をインストールしたら無問題。 (^^)

Android 2.3

USB-LCD やタッチパネルをつなぐためには、Android kernelをソースからビルドする必要がある。