我无法使用新的清单合并进行构建。 Gradle抱怨我的测试使用minSdkVersion="14"
,而Espresso有minSdkVersion="8"
。我实际上没有一个清单我的测试文件夹(androidTest
),但看起来清单合并正在临时文件夹中创建一个。
合并创建的临时清单:
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
<application>
<uses-library android:name="android.test.runner" />
</application>
<instrumentation android:name="com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
android:targetPackage="mypackage.android"
android:handleProfiling="false"
android:functionalTest="false"
android:label="Tests for mypackage.android"/>
</manifest>
错误和调试日志:
Merging uses-sdk with lower test manifest:5:5
Merging application with lower test manifest:7:5
Merging result:ERROR
{PATH_TO_PROJECT}\build\intermediates\exploded-aar\com.jakewharton.espresso\espresso\1.1-r2\AndroidManifest.xml:0:0 Error:
uses-sdk:minSdkVersion 8 cannot be smaller than version 14 declared in library test manifest
:MyApp:processDebugTestManifest FAILED
:MyApp:processDebugTestManifest (Thread[Daemon Thread 6,5,main]) completed. Took 0.107 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':MyApp:processDebugTestManifest'.
> java.lang.RuntimeException: Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 14 declared in library test manifest
知道我可以做些什么来解决这个问题,或者它是清单合并的错误?
答案 0 :(得分:1)
尝试将此行添加到build.gradle
android {
useOldManifestMerger true
...
}
答案 1 :(得分:-1)
此故障单的CL发布后,此问题将得到解决: