gpt4 book ai didi

java - 在 Android 构建上找不到 androidTestCompile

转载 作者:行者123 更新时间:2023-12-01 09:04:25 25 4
gpt4 key购买 nike

another question之后,已解决。

我正在关注Start Developing for Android Pluralsight 类(class)。我们即将添加测试。说明中表示将 androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' 添加到 build.gradle 文件(位于app 模块)。

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

当我同步构建时,我可能会出现错误:

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

我应该使用建议的修复吗?目前我认为我更有可能在某个地方缺少一个图书馆。

根据安迪的建议

我已将 block 移到外面,错误是:

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

最佳答案

dependency block 移出 android block ,并将 minSdkVersion 提高到至少 8:

android {  
minSdkVersion: 8
//...
}

dependencies {
// ....
}

关于java - 在 Android 构建上找不到 androidTestCompile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41399724/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com