Scala on Android

The comprehensive documentation

  • Information reliability Sustainable Won't become outdated
  • Last edit Fri Jul 10 19:44:32 2015 +0200
  • Edit on GitHub

Working with the sbt command line

Even though it it possible to configure your IDE to handle some basic tasks such as compiling and running your app, or executing tests, you will eventually fall back to the command line in order to fix build issues or trigger more advanced tasks. It is therefore inevitable to get a basic understanding for the sbt command line.

The interactive sbt shell is started by simply typing sbt and hitting enter in your terminal. Alternatively, to only run a single sbt command, it is possible to pass an argument to sbt, e.g. sbt android:packageRelease.

  • Information reliability Sustainable Won't become outdated
  • Last edit Fri Jul 10 19:44:32 2015 +0200
  • Edit on GitHub

Common tasks

Below is a list of common and important sbt, and its respective Android plugin, commands.

CommandDescription
android:runCompile the project, package a debug apk and deploy it to an active device or emulator
android:packageReleaseCreate a signed apk
android:packageDebugCreate a debug apk
testRun unit tests and report results
reloadApply changes that have been made to your sbt configuration
compileCompile the source code
cleanRemove all compiled and generated code, delete ProGuard cache. This might be useful when experiencing issues with incremental builds.

If you find yourself running a particular android:* task very often, you may want to add a shortcut to your sbt configuration. E.g. run <<= run in Android allows you to trigger the task from the console via run instead of android:run.

Comments