I'd like to increase the minSdk
to 21
just for androidTest
. Is this possible without introducing a product flavor?
Note: Using Android Gradle Plugin 3.0, and my app's minSdk needs to be 16
.
I'd like to increase the minSdk
to 21
just for androidTest
. Is this possible without introducing a product flavor?
Note: Using Android Gradle Plugin 3.0, and my app's minSdk needs to be 16
.
You can try as this post suggests creating a new Manifest in the folder where you run your test adding the attribute
uses-sdk
as per documentation
Also is indicated to play in gradle with some if statements in the gradle file, but they are ugly. Anyway you could use it as a plan B solution:
if (gradle.startParameter.taskNames.contains(":app:assembleDebug")) {
minSdkVersion 21
}else{
minSdkVersion 14
}
You can add the minSdk in either the projects gradle file or manifest. When adding the minSdk it means that you are specifying the minimum sdk level that you have designed and tested your app. You also would want to add the targetSdk. A google support link which may interest you https://developer.android.com/training/basics/supporting-devices/platforms.html
In the manifest it would look like
<manifest xmlns:android="http://schemas.android.com/apk/res/android" ... >
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
...
</manifest>
In your gradle file
defaultConfig {
applicationId "com.project.projectName"
minSdkVersion 14
targetSdkVersion 21
}