ligi
ligi

Reputation: 39529

increase minSdk for androidTest

what is a good way to increase the minSDK for androidTest? Background is this:

/tmp/manifestMerge4291657485597766957.xml:0:0 Error:
    uses-sdk:minSdkVersion 5 cannot be smaller than version 7 declared in library com.squareup.assertj:assertj-android:1.0.0
:android:processForAmazonDebugTestManifest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':android:processForAmazonDebugTestManifest'.
> java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 5 cannot be smaller than version 7 declared in library com.squareup.assertj:assertj-android:1.0.0

I do not just want to increase the minSDK and cut out users just for a lib that is only used in testing.

Upvotes: 0

Views: 221

Answers (1)

Mykola Dzyuba
Mykola Dzyuba

Reputation: 21

This could be done by adding a product flavor to the gradle.build:

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        packageName "org.foo"
        minSdkVersion 8
        targetSdkVersion 19
    }

    productFlavors {
        JellyBean {
            minSdkVersion 17
        }
    }
}

The tasks to build and run tests for JellyBean flavor are:

./gradlew assembleJellyBeanDebugTest
./gradlew connectedAndroidTestJellyBeanDebug

Upvotes: 2

Related Questions