sbt
Scala Build Tool
Installation
To install sbt, download it from the official website and follow the install instructions. The Android SDK Plugin for SBT requires no manual download, but will instead be loaded by sbt as a dependency, which will be explained later. Please make sure to read the excellent article Scala on Android - Setting sbt configuration by 47 Degrees if you are starting from zero.
Structure
A sbt project has the following directory structure:
- project-root/
- project/
- Build.scala
Your actual build configuration. Here you specify your (sub-) projects, manage application dependencies and configure ProGuard.
You can also manage your build via
/build.sbt
. However,/project/Build.scala
is written in actual Scala code, is slightly more expressive and allows you to keep all of your configuration files in the/project
folder. - build.properties
An optional, but recommended file that specifies the sbt version for this build.
- plugins.sbt
Dependencies for sbt plugins are managed in this file. This is necessary, as we need to rely on Android SDK Plugin for SBT here.
- Build.scala
- src/
- main/
- AndroidManifest.xml
- res/
Common Android resource folders such as
drawable/
andvalues/
go here. - java/
Java source files that may interact with the Scala sources and vice versa.
- scala/
The actual application code is located in this folder if you're not building a Java app with sbt (which is also possible).
- test/
- AndroidManifest.xml
Optional manifest file to use when tests are executed
- res/
- java/
- scala/
- AndroidManifest.xml
- androidTest/
A folder for instrumentation tests.
- main/
- project/
Further reading
- Scala Build Tool
Official project page
- sbt: Download
Official project page
- sbt Reference Manual
Official sbt documentation
- sbt tutorial: Library dependencies
Official tutorial
- sbt tutorial: Getting started
Official tutorial
- Android SDK Plugin for SBT
"An easy-to-use sbt plugin for working with all Android projects"
- sbt plugin: gen-idea
GitHub repository
- Scala on Android - Setting sbt configuration
Detailed explanation of sbt and the Android SDK Plugin for SBT fundamentals