Subscribed unsubscribe Subscribe Subscribe

Kentaro Kuribayashi's blog

Software Engineering, Management, Books, and Daily Journal.

"Hello, Android!" by Scala

Install Dev Tools

Install scala, sbt, android-sdk by homebrew:

$ brew install scala sbt android-sdk

Set $ANDROID_HOME and $PATH:

export ANDROID_HOME=/usr/local/Cellar/android-sdk/r16
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH

Install SDK:

$ android

f:id:antipop:20120220233312p:plain

Create AVD: Tools -> Manage AVDs:

f:id:antipop:20120220233526p:plain

Install android-plugin:

$ git clone git://github.com/jberkel/android-plugin.git
$ cd android-plugin
$ sbt publish-local

Install giter8:

$ curl https://raw.github.com/n8han/conscript/master/setup.sh | sh
$ ~/bin/cs n8han/giter8

Hello, World App

Create template:

$ g8 jberkel/android-app

Template for Android apps in Scala

package [my.android.project]: org.kentarok.myapp
name [My Android Project]: MyApp
main_activity [MainActivity]:
scala_version [2.9.1]: 2.9.1
api_level [10]: 15
useProguard [true]: true

Applied jberkel/android-app.g8 in myapp

Launch sbt:

$ cd myapp
$ sbt
> android:package-debug
> android:emulator-start <my_avd> # Your own AVD name
> android:install-emulator

f:id:antipop:20120220233324p:plain