tony
06/16/2022, 9:41 PMCould 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 Studiotony
06/16/2022, 9:41 PM* 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)
...
tony
06/16/2022, 9:56 PMtony
06/16/2022, 10:11 PM: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 bugtony
06/16/2022, 10:26 PMconfigurations.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!