anyone ever seen this error before? ```Could not r...
# community-support
t
anyone ever seen this error before?
Copy code
Could not resolve all dependencies for configuration ':lib:debugUnitTestCompileClasspath'.
Expected to find a selector with a failure but none was found
stacktrace in thread everything builds fine from the command line. This failure only occurs when attempting to sync the project in Android Studio
Copy code
* Exception is:
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not resolve all dependencies for configuration ':lib:debugUnitTestCompileClasspath'.
Expected to find a selector with a failure but none was found
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:346)
	at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:127)
...
org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':lib:debugUnitTestCompileClasspath'.
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.wrapException(ErrorHandlingConfigurationResolver.java:107)
	at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.resolveGraph(ErrorHandlingConfigurationResolver.java:78)
...
	at com.android.build.gradle.internal.ide.dependencies.ArtifactUtils.asMultiMap(ArtifactUtils.kt:449)
	at com.android.build.gradle.internal.ide.dependencies.ArtifactUtils.getAllArtifacts(ArtifactUtils.kt:336)
...
Caused by: java.lang.IllegalStateException: Expected to find a selector with a failure but none was found
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.getFailure(EdgeState.java:352)
	at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.ResolutionFailureCollector.visitNode(ResolutionFailureCollector.java:62)
...
	at com.android.build.gradle.internal.ide.dependencies.ArtifactUtils.asMultiMap(ArtifactUtils.kt:449)
	at com.android.build.gradle.internal.ide.dependencies.ArtifactUtils.getAllArtifacts(ArtifactUtils.kt:336)
...
this happens on a PR where we've removed an unused dependency. We've tried it on a fresh environment, as well as on the original environment while cleaning various caches. It is very reproducible across environments
super weird. Consider this project relationship:
Copy code
:lib --implementation--> :base
where
:base
has
api('some-library')
If I remove the
api('some-library')
from
:base
, then I can't sync my project. If I add
implementation('some-library')
to
:lib
, I can't sync my project (even though it's :lib where the failure appears). If I leave
api('some-library')
and also add
implementation('some-library')
to
:lib
, then I get the same failure! This makes no sense. Since the failure bubbles up from Gradle infra (
org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.java
), I have to assume it's a gradle bug
the proximal cause appears self inflicted. I have discovered some code doing this:
Copy code
configurations.all {
  resolutionStrategy.eachDependency {
solely for the purpose of finding dynamic dependencies or snapshots and throwing if so. This is not the right API for that!