Tuesday, July 19, 2011

Using scala on android with maven

If you want to deploy an application written in Scala to the android platform then use this sample project to do the whole thing using maven plugins (although you still need a separate download of the Android SDK):

svn checkout http://moten-util.googlecode.com/svn/android-scala-sample android-scala-sample

You need the ANDROID_HOME environment variable to use the maven-android-plugin. On my machine this is

ANDROID_HOME='/opt/android/android-sdk-linux_x86'

cd to the android-scala-sample directory and type

mvn clean package

This will compile and test the scala source and build an android binary using ProGuard to strip out unused classes (needed to remove the bulk of the scala dependency).

If you have the emulator running then deploy to the emulator with

mvn android:deploy

This sample app is just a hello world app for you to modify as you like.

1 comment:

Dmitry Stropalov said...

Thank you for this template. I've tried original examples and solutions from android-maven home page but with no luck.