Setup

Prerequisites

  1. Java with JAVA_HOME variable must be installed.
  2. ANDROID_HOME variable must be set and pointing to your android sdk directory.
  3. Plugin also requires sbt.
  • Linux (Debian/Ubuntu)
  • Linux (RPM-based)
  • Mac OS X
  • Windows
  • Manual

Installing sbt on Ubuntu / Debian:

echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt

Creating or Importing an Android Project

There are two ways of working with sbt-android:

  1. Creating project with gen-android task
  2. Using android gradle build plugin which can import existing gradle project for you
  • Create a new project
  • Import an existing project
  • Install `sbt`
  • Add `sbt-android` to _sbt_’s global plugins: For Mac OS X, Linux (if directory isn’t there, just create it):$ cd $HOME/.sbt/0.13/plugins/ $ echo ‘addSbtPlugin(“org.scala-android” % “sbt-android” % “1.7.6”)’ > android.sbt
  • Create your project directory, I.e. myproject$ mkdir myproject
  • create new sbt project with sbt `gen-android` task$ sbt $ gen-android com.mypackage.test test
  • Project creation is finished, you can now import your project with intellij, eclipse. To simply run project you can invoke Android run task$ android:run