在Android版本上找不到androidTestCompile [英] Cannot find androidTestCompile on Android build
问题描述
继续另一个问题,已解决。
我正在关注开始Android版开发课程。我们正准备添加测试。说明说要添加 androidTestCompile'com.android.support.test.espresso:espresso-core:2.2.2'
到 build.gradle
文件( app
模块中的文件)。
I'm following through the Start Developing for Android course in Pluralsight. We're just about to add tests. The instructions say to add add androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
to the build.gradle
file (the one in the app
module).
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.3'
defaultConfig {
applicationId 'com.sqisland.android.hello'
minSdkVersion 1
targetSdkVersion 24
versionCode 1
versionName '1.0.0'
}
dependencies {
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
}
}
当我同步构建时,我可能会出错:
When I sync the build I can an error though:
Error:Execution failed for task ':app:processDebugAndroidTestManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 8 declared in library [com.android.support.test.espresso:espresso-core:2.2.2] F:\BanksySan\Development\PluralSight\android-hello-world\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.test.espresso" to force usage
我应该使用建议的修复?目前我认为我更有可能在某个地方错过了一个图书馆。
Should I use the suggested fix? At the moment I'm thinking that's it's more likely that I'm missing a library somewhere.
在Andy的建议下面
我已将块移到外面,错误是:
I've moved the block outside, the error is:
Error:Execution failed for task ':app:processDebugAndroidTestManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 8 declared in library [com.android.support.test.espresso:espresso-core:2.2.2] F:\BanksySan\Development\PluralSight\android-hello-world\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.test.espresso" to force usage
推荐答案
将依赖项
块移出 android
块并提高 minSdkVersion
至少 8
:
Move the dependencies
block out of android
block and raise your minSdkVersion
to at least 8
:
android {
minSdkVersion: 8
//...
}
dependencies {
// ....
}
这篇关于在Android版本上找不到androidTestCompile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!