Hi All :android-wave: , Getting errors in setting ...
# compose
a
Hi All 👋 , Getting errors in setting up screenshot testing. https://developer.android.com/studio/preview/compose-screenshot-testing Error in thread 🧵 Please help! Thank You thank you color
Copy code
> Task :barcodes:updateDebugScreenshotTest FAILED

Failures (1):
  Preview Screenshot Test Engine
    => java.lang.NoSuchMethodError: 'java.util.stream.Collector com.google.common.collect.Sets.toImmutableEnumSet()'
       com.android.resources.ResourceType.<clinit>(ResourceType.java:175)
       java.base/java.lang.reflect.Method.invoke(Method.java:568)
       java.base/java.lang.Class.getEnumConstantsShared(Class.java:3837)
       java.base/java.lang.System$2.getEnumConstantsShared(System.java:2284)
       java.base/java.util.EnumMap.getKeyUniverse(EnumMap.java:747)
       java.base/java.util.EnumMap.<init>(EnumMap.java:135)
       com.android.tools.res.ids.SingleNamespaceIdMapping.<init>(SingleNamespaceIdMapping.kt:29)
       com.android.tools.res.ids.FrameworkResourceIds.<init>(ResourceIdManagerBase.kt:293)
       com.android.tools.res.ids.FrameworkResourceIdsProvider$Companion.<clinit>(ResourceIdManagerBase.kt:255)
       com.android.tools.res.ids.FrameworkResourceIdsProvider.<clinit>(ResourceIdManagerBase.kt)
       [...]

Test run finished after 160 ms
[         3 containers found      ]
[         0 containers skipped    ]
[         1 containers started    ]
[         0 containers aborted    ]
[         0 containers successful ]
[         1 containers failed     ]
[         0 tests found           ]
[         0 tests skipped         ]
[         0 tests started         ]
[         0 tests aborted         ]
[         0 tests successful      ]
[         0 tests failed          ]


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':barcodes:updateDebugScreenshotTest'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
d
This is a classic Java error indicating a dependency version conflict. Your project and the screenshot testing tool's dependencies were pulling in multiple, incompatible versions of Google's Guava library. The test runner required a newer version of Guava, but your project's dependency resolution is selecting an older one at runtime. you can resolved this by forcing Gradle to use a single, recent version of Guava across all modules. This can done by adding a
resolutionStrategy
to the root
build.gradle.kts
file:
Copy code
// In root build.gradle.kts
allprojects {
    configurations.all {
        resolutionStrategy.eachDependency {
            if (requested.group == "com.google.guava" && requested.name == "guava") {
                useVersion("33.2.0-jre") // Force a stable, recent version
                because("Align Guava to prevent runtime errors.")
            }
        }
    }
}