0

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.

ligi
  • 39,001
  • 44
  • 144
  • 244
  • Can't you use config Gradle to add this lib only while in testing, and also change minSDK, in both script and manifest? (no sure the last one is possible though, it been a while since I last gradled) – TacB0sS Sep 09 '14 at 21:28

1 Answers1

2

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
  • Thanks - upvoted. But as this is more a workaround I will not accept this answer and hope for something where I do not have to introduce a flavor – ligi Sep 28 '14 at 12:04