The UiAutomator v2.+ version supports only SDK level 18+ and according to documentation uiautomator shipped first with SDK Level 16. I need a way to include that version in my gradle file rather than v2.1.1. androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
Add this specific AndroidManifest.xml into androidTest folder
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="your.package">
<uses-sdk
android:targetSdkVersion="22"
android:minSdkVersion="16"
tools:overrideLibrary="android.support.test.uiautomator.v18"/>
</manifest>
Trick here is done with:
tools:overrideLibrary marker
A special marker that can only be used with uses-sdk declaration to override importing a library which minimum SDK version is more recent than that application's minimum SDK version. Without such a marker, the manifest merger will fail. The marker will allow users to select which libraries can be imported ignoring the minimum SDK version.
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