Gradle build and deploy specific buildtype

2019-06-24 03:48发布

问题:

I want to build my gradle project with a certain buildtype and deploy it on device with a single command.

My build.gradle is setup for multiple buildtypes such as live and release.

I worked with maven before and i look for an equivalent of:

mvn clean install -P release android:deploy android:run

回答1:

Here is the command to build and deploy through a specified BuildType. ( Thank you Varun! )

gradle installProfilename

Where Profilename of course would be the name of the BuildType specified in build.gradle

Example.:

gradle installRelease

Would build with the release profile:

buildTypes {

    release {
        debuggable false
        jniDebugBuild false
        signingConfig signingConfigs.main
        . . . 
    }

Addition.:

Gradle can show you what tasks are available.:

gradle tasks