Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build only single buildType with Android Studio and/or Gradle

I've several build types in my build.gradle:

signingConfigs {
  debug {
    storeFile file("debug.keystore")
    storePassword = "android"
    keyAlias = "androiddebugkey"
    keyPassword = "android"
  }
  unsigned{
    storePassword = ""
    keyAlias = ""
    keyPassword = ""
  }
  release {
    storeFile file("release.keystore")
    keyAlias "alias"
    storePassword "foo"
    keyPassword "bar"
  }
}

buildTypes {
  release {
    debuggable false
    jniDebugBuild false
    signingConfig signingConfigs.release
  }
  unsigned {
    debuggable false
    jniDebugBuild false
    signingConfig signingConfigs.unsigned
  }
  debug {
    debuggable true
    jniDebugBuild true
    signingConfig signingConfigs.debug
  }
}

which work fine but the problem is that I don't know (and I haven't find after lot of searching) a way how to build only single build type either from Android Studio or command-line.

Do you please know?

like image 605
Blackhex Avatar asked Oct 08 '13 08:10

Blackhex


People also ask

How many build Gradle file is there in one Android project?

gradle files in an Android Studio project?

What is Buildtype in Gradle Android?

Build types define certain properties that Gradle uses when building and packaging your app, and are typically configured for different stages of your development lifecycle.

What is difference between assemble and build in Gradle?

assemble will build your artifacts, and build will assemble your artifacts with additional checks. You can have a look on the tasks that will be executed by using the --dry-run flag. e.g. You will see that apart from assemble also lint and test will be executed.

How do I change a variant in build?

NOTE: By default, the Android Studio will generate "debug" and "release" Build Types for your project. So, to change a Build Type, all you need to do is just select your Build Type from the Build Variant and after the project sync, you are good to go.


1 Answers

Documentation says (http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Android-tasks and http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Building-and-Tasks) that you can use the following commands to produce specific build types:

gradle assembleDebug
gradle assembleRelease
like image 180
orcy Avatar answered Nov 09 '22 22:11

orcy