Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tools:overrideLibrary not working

I'd like to use library android.support.test.uiautomator.v18in a build supporting Android back to level 11. My manifest begins:

<?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="xxxdeletedxxx"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-sdk
        android:targetSdkVersion="23"
        android:minSdkVersion="11"
        tools:overrideLibrary="com.android.support.test.uiautomator:uiautomator-v18" />

and in build.gradle I have

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

Running ./gradlew connectedCheck gives:

* What went wrong:
Execution failed for task ':app:processDebugAndroidTestManifest'.
> java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 11 cannot be smaller than version 18 declared in library [com.android.support.test.uiautomator:uiautomator-v18:2.1.1] /Users/ewanbenfield/AndroidStudioProjects/TM/app/build/intermediates/exploded-aar/com.android.support.test.uiautomator/uiautomator-v18/2.1.1/AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="android.support.test.uiautomator.v18" to force usage
like image 579
CharleyGC Avatar asked Feb 15 '16 11:02

CharleyGC


1 Answers

There is probably a difference between the packages mentioned in your build.gradle and your AndroidManifest.

AndroidManifest should at least contain

<uses-sdk
    tools:overrideLibrary="com.android.support.test.uiautomator.v18"/>

and your build.gradle should contain

androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'

I recently had a similar problem where I forgot to put 'com.' in my AndroidManifest

like image 167
Wirling Avatar answered Sep 21 '22 12:09

Wirling