运行浓缩咖啡测试./gradlew connectedAndroidTest
时出现以下错误
> Task :app:fixStackFramesLiveDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:fixStackFramesLiveDebugAndroidTest'.
> Cannot convert the provided notation to a File or URI: classes.jar (androidx.databinding:databinding-adapters:3.4.1).
The following types/formats are supported:
- A String or CharSequence path, for example 'src/main/java' or '/usr/include'.
- A String or CharSequence URI, for example 'file:/usr/include'.
- A File instance.
- A Path instance.
- A Directory instance.
- A RegularFile instance.
- A URI or URL instance.
app/build.gradle
包含以下内容
...
android {
.....
defaultConfig {
...
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
...
}
dataBinding {
enabled = true
}
}
...
无论咖啡依赖项如何,我都会收到上述错误。有人可以帮忙解决此问题。我是android和espresso的新手。 我不确定是否错过了信息。如果需要,请告知。
答案 0 :(得分:3)
在启用Gradle Kotlin DSL的Android Studio 4.0 Canary 4上,我得到了同样的错误:
Unable to resolve dependency for ':app@debug/compileClasspath': Cannot convert the provided notation to a File or URI: {dir=libs, include=[*.jar]}.
从以下位置更改构建脚本后
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
}
到
dependencies {
implementation(fileTree(Pair("dir", "libs"), Pair("include", listOf("*.jar"))))
}
一切正常。 WTF。
答案 1 :(得分:1)
将gradle更新为3.4。+后,我遇到了这个错误。降级到3.3.2之后,我能够进行构建而没有任何问题。