0. Check Your Android SDK installation
- Make sure the Android SDK is fully updated (minimum build-tools 19.1.0 and up).
- Set the environment variable
ANDROID_HOME
pointing to the path where the Android SDK is unpacked.
1. Download and Install sbt
sbt, the Scala build tool, is required. Follow the instructions on the sbt website to install it.
2. Configure Your Project
Scala’s Android support requires adding sbt-android as a plugin for sbt (Scala’s build tool) to your project configuration. To do that:
- Assuming that your project is called my-example-project, create a directory named
my-example-project/
and enter it. - Create a file called
build.sbt
(if it doesn’t exist) inside yourmy-example-project/
directory and add the linesandroidBuild
andscalaVersion := "2.11.8"
to that file. (Scala on Android currently requires Scala 2.11.) - Create a directory called
project/
(or enter that directory if it exists). - Create another file called
build.sbt
(if it doesn’t exist) inside yourmy-example-project/project/
directory. - Add the line
addSbtPlugin("org.scala-android" % "sbt-android" % "1.7.6")
to that file. - Create
build.properties
inside yourmy-example-project/project/
directory. - Add the line
sbt.version=0.13.16
3. Create an Android Project
- Run sbt.
- Inside the sbt shell, execute
gen-android com.mypackage.test test
to create an Android project called test which uses version 23 of the Android SDK.
4. Run Your Android Application
android:run
builds your application, then installs and runs it on your device.