I have been developing automated tests to my app, however, we reached a point where we have to change options outside the app environment. To do so we decided to use the latest UIAutomator v2. By doing so we are able to use espresso testing inside our app and UI Automator for system popups or change settings in the same test. The issue at this point is that we have to maintain min SDK 16 for contract purposes. This makes it impossible to use UIAutomator v2. The compiler itself suggests a solution :
Suggestion: use tools:overrideLibrary="android.support.test.uiautomator.v18" to force usage
My current gradle relevant gradle config:
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
// default apk name (to be overriden)
project.archivesBaseName = "AwessomeApp";
android.enforceUniquePackageName=false
defaultConfig {
String charPrefix = "AWS"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode appVersion.getCode()
versionName appVersion.getName()
applicationId "pt.company.awesome"
testApplicationId "pt.company.test"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
However, it doesn't work, probably because we have the minSdk set by the root project using gradle. If i bump the project version to 18 it works flawlessly. At this point i have no idea on how to solve this issue. Is it possible to do something like set a different minSdk por testing or flavor?