工具:overrideLibrary不工作

时间:2016-02-15 11:07:52

标签: android android-studio

我想在支持Android的构建中使用库android.support.test.uiautomator.v18回到第11级。我的清单开始了:

<?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" />

在build.gradle中我有

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'
        }
    }
}

运行./gradlew connectedCheck给出:

* 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

2 个答案:

答案 0 :(得分:0)

可能是这个错误:https://code.google.com/p/android/issues/detail?id=230777(“构建工具:processDebugManifest步骤失败或取决于项目依赖项的顺序”)

在报告的案例中,重新排序依赖关系有效。

答案 1 :(得分:0)

build.gradle和AndroidManifest中提到的软件包之间可能存在差异。

AndroidManifest至少应该包含

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

并且你的build.gradle应该包含

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

我最近有一个类似的问题,我忘了把'com'。在我的AndroidManifest中