I have 2 flavors of my application: paid and free. I have 2 build types: debug and release.
When I issue gradlew
tasks I get, among other things:
connectedFreeDebugAndroidTest - Installs and runs the tests for freeDebug on connected devices.
connectedPaidDebugAndroidTest - Installs and runs the tests for paidDebug on connected devices.
But I do not get connectedFreeReleaseAndroidTest neither connectedPaidReleaseAndroidTest.
However, there are for example: testFreeReleaseUnitTest, installFreeRelease and other such tasks dealing with release build type. But no testing tasks for the release build type.
Why is that?
In my build.gradle
I have:
androidTestCompile ('com.android.support.test.espresso:espresso-core:+')
androidTestCompile ('com.android.support.test:runner:+')
and also release
type only in buildTypes
Gradle allows you to define one or more default tasks that are executed if no other tasks are specified. defaultTasks 'clean', 'run' tasks. register('clean') { doLast { println 'Default Cleaning!
You can execute multiple tasks from a single build file. Gradle can handle the build file using gradle command. This command will compile each task in such an order that they are listed and execute each task along with the dependencies using different options.
Gradle has different phases, when it comes to working with the tasks. First of all, there is a configuration phase, where the code, which is specified directly in a task's closure, is executed. The configuration block is executed for every available task and not only, for those tasks, which are later actually executed.
In your build.gradle, add:
android {
testBuildType "release"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With