Sarath
Sarath

Reputation: 1496

Cannot convert the provided notation to a File or URI

I am getting the following error when running espresso test ./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 contains the following

...
android {
  .....
  defaultConfig {
     ...
     testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     ...
  }
  dataBinding {
     enabled = true
  }
}
...

Irrespective of espresso dependencies, I am getting the above error. Can someone please help to resolve this issue. I am new to android and espresso. I am not sure if I had missed out information. Please let know if needed.

Upvotes: 2

Views: 5789

Answers (2)

TonnyL
TonnyL

Reputation: 1345

On Android Studio 4.0 canary 4 with Gradle Kotlin DSL enabled, I got the kinda same error:

Unable to resolve dependency for ':app@debug/compileClasspath': Cannot convert the provided notation to a File or URI: {dir=libs, include=[*.jar]}.

After I changed my build script from

dependencies {
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
}

to

dependencies {
    implementation(fileTree(Pair("dir", "libs"), Pair("include", listOf("*.jar"))))
}

everything works well. WTF.

Upvotes: 3

SinzianaG
SinzianaG

Reputation: 174

I ran into this error after updating gradle to 3.4.+ After I downgraded to 3.3.2 I was able to build without any issues.

Upvotes: 1

Related Questions