Sbt option Example value Gradle option Example value Description
name name := "yourproject" - - Name of your project
organization organization := "com.example.yourproject" applicationId applicationId 'com.example.yourproject' Package, id of your project
versionName versionName := "0.0.1" versionName versionName 1 Version of your application
versionCode versionCode := Some(1) versionCode versionCode 1 Code version of your application
scalaVersion scalaVersion :="2.11.7" - - Scala version which is used in current project
javacOptions javacOptions ++= Seq("-source", "1.7", "-target", "1.7") compileOptions
compileOptions {
  sourceCompatibility JavaVersion.VERSION_1_7
  targetCompatibility JavaVersion.VERSION_1_7
  }
Options for Java in current project, Java code version, etc.
scalacOptions scalacOptions ++=Seq("-feature", "-Xexperimental" ,"-language:implicitConversions", "-language:postfixOps", "-target:jvm-1.7") - - Options for Scala
platformTarget platformTarget in Android :="android-23" targetSdkVersion, compileSdkVersion targetSdkVersion 23, compileSdkVersion 23 Compile and target sdk for project
minSdkVersion minSdkVersion in Android :="21" minSdkVersion minSdkVersion 21 Minimum android SDK version to support
resolvers resolvers ++= Seq(Resolver.mavenLocal, Resolver.sonatypeRepo("releases")) repositories repositories { jcenter() maven { url 'https://maven.fabric.io/public' } } Repositiories for dependencies
fork in Test fork in Test := true - - Fork process for testing
packagingOptions packagingOptions in Android := PackagingOptions(excludes = Seq("META-INF/LICENSE.txt")) packagingOptions packagingOptions { exclude 'META-INF/LICENSE.txt' } Packaging options, i.e. excluding META-INF files
proguardOptions proguardOptions in Android ++= io.Source.fromFile("proguard-sbt.txt").getLines.toSeq proguardFiles Proguard options
collectJni collectJni in Android :={ List() } ? Collecting jni files (not needed to set if not using jni)
collectResources collectResources in Android := { val (assets, res)=(collectResources in Android).value (assets ** "*").get.foreach(_.delete()) (assets, res)} ? Collecting resources from project to apk, settings up paths, deleting resources from apk
libraryProject libraryProject in Android := true dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) } Configure current sbt project as library project
transitiveAndroidLibs transitiveAndroidLibs in Android := true compile('dependency'){ transitive=true; } Include transitive dependencies
useProguard useProguard in Android := true minifyEnabled minifyEnabled true Enable proguard
useProguardInDebug useProguardInDebug in Android := (useProguard in Android).value minifyEnabled minifyEnabled true Enable proguard in debug mode
proguardCache proguardCache ++= "com.google.common" :: "org.bouncycastle" :: Nil - - Proguard caching <link to section>
typedResources typedResources in Android := true - - Enable generating typed resource from views (type safe for xml views in scala code)
dexMulti dexMulti in Android := false multiDexEnabled multiDexEnabled true Enable / disable multidex
dexMaxHeap dexMaxHeap in Android :="2048M" dexOptions { javaMaxHeapSize } dexOptions { javaMaxHeapSize "2048M" } Set dex heap size
dexAdditionalParams dexOptions Set other dex options
val supportLibVersion val supportLibVersion="23.1.1" def supportLibVersion def supportLibVersion="23.1.1" Sample of creating local variable in build file
libraryDependencies libraryDependencies ++= Seq ( "package" % "id" % "version") dependencies dependencies { compile ""} Specify project dependencies
protifySettings protifySettings - - Add support for protify (Instant mode but better)
sdkPath sdkPath in Android := "<path>" - - Specify sdkPath
ndkPath ndkPath in Android := "<path>" - - Specify ndkPath
resValue resValues += (("string", "gcm_defaultSenderId", "yourid")) resValue defaultConfig { resValue "string", "gcm_defaultSenderId", "youid" } Add resValue
flavors flavors += (("flavor1", List(applicationId := "com.example.flavor1", versionCode := 20))) productFlavors productFlavors { flavor1 { packageName "com.example.flavor1" versionCode 20 } flavor2 { packageName "com.example.flavor2" minSdkVersion 14 } } Setup for product flavors (link to google)
variant variant += (("release", List(options...))) buildTypes buildTypes { release {} debug {} } Setup project build types (link to google)
buildToolsVersion buildToolsVersion in Android :="23.0.2" buildToolsVersion buildToolsVersion "23.0.2" Specify build tools version
aar aar("com.android.support" % "appcompat-v7" % "23.1.1") - - Add aar dependecy to project
apklib apklib("package" % "id" % "version") - - Add apklib to dependency
lintFlags
lintFlags := {
  val flags = lintFlags.value
  implicit val output = outputLayout.value
  val layout = projectLayout.value
  layout.bin.mkdirs()
  val config = layout.libraryLintConfig
  config.getParentFile.mkdirs()
  (layout.manifest relativeTo layout.base) foreach { path =>
    val lintconfig =
      <lint>
        <issue id="ParserError">
          <ignore path={path.getPath}/>
        </issue> 
      </lint>
    xml.XML.save(config.getAbsolutePath, lintconfig, "utf-8")
    flags.setDefaultConfiguration(config)
  }
  flags
}
lintOptions lintOptions { abortOnError false} Flags for lint
lintEnabled lintEnabled := true Enable, diable lint
shrinkResources shrinkResources := true shrinkResources shrinkResources true Enable shrinking resources