相关文章推荐
安静的李子  ·  "vamX 1.15 - Mean Sex ...·  3 月前    · 
有腹肌的警车  ·  GitHub - ...·  7 月前    · 
爱搭讪的芒果  ·  Java 11 升Java 17 ...·  7 月前    · 

Error NoSuchMethodError com.google.common.collect.ImmutableMap #1140

Closed

Description

Description
A clear and concise description of what the bug is.

Steps to Reproduce

  • get paparazzi sample project
  • add dependency to paparazzi/sample/build.gradle
    testImplementation("com.lemonappdev:konsist:0.13.0")
  • Run task of sample module -> recordPaparazziTests
  • error:

    app.cash.paparazzi.sample.ComposeA11yTest > compositeItems FAILED
        java.lang.NoSuchMethodError: 'com.google.common.collect.ImmutableMap com.google.common.collect.ImmutableMap$Builder.buildOrThrow()'
            at com.google.common.collect.SparseImmutableTable.<init>(SparseImmutableTable.java:85)
            at com.google.common.collect.SparseImmutableTable.<clinit>(SparseImmutableTable.java:32)
            at com.google.common.collect.ImmutableTable.of(ImmutableTable.java:103)
            at com.google.common.collect.ImmutableTable$Builder.buildOrThrow(ImmutableTable.java:288)
            at com.google.common.collect.ImmutableTable$Builder.build(ImmutableTable.java:274)
            at app.cash.paparazzi.internal.resources.base.BasicStyleResourceItem.<init>(BasicStyleResourceItem.kt:64)
            at app.cash.paparazzi.internal.resources.RepositoryLoader.createStyleItem(RepositoryLoader.kt:737)
            at app.cash.paparazzi.internal.resources.RepositoryLoader.createResourceItem(RepositoryLoader.kt:525)
            at app.cash.paparazzi.internal.resources.RepositoryLoader.parseValueResourceFile(RepositoryLoader.kt:355)
            at app.cash.paparazzi.internal.resources.RepositoryLoader.loadResourceFile(RepositoryLoader.kt:308)
            at app.cash.paparazzi.internal.resources.RepositoryLoader.loadResourceFile(RepositoryLoader.kt:221)
            at app.cash.paparazzi.internal.resources.RepositoryLoader.loadFromResFolder(RepositoryLoader.kt:202)
            at app.cash.paparazzi.internal.resources.RepositoryLoader.loadRepositoryContents(RepositoryLoader.kt:163)
            at app.cash.paparazzi.internal.resources.FrameworkResourceRepository$Loader.loadRepositoryContents(FrameworkResourceRepository.kt:235)
            at app.cash.paparazzi.internal.resources.FrameworkResourceRepository.load(FrameworkResourceRepository.kt:97)
            at app.cash.paparazzi.internal.resources.FrameworkResourceRepository.access$load(FrameworkResourceRepository.kt:38)
            at app.cash.paparazzi.internal.resources.FrameworkResourceRepository$Companion.create(FrameworkResourceRepository.kt:359)
            at app.cash.paparazzi.internal.Renderer.prepare(Renderer.kt:73)
            at app.cash.paparazzi.Paparazzi.prepare(Paparazzi.kt:158)
            at app.cash.paparazzi.Paparazzi$apply$statement$1.evaluate(Paparazzi.kt:124)
            at app.cash.paparazzi.agent.AgentTestRule$apply$1.evaluate(AgentTestRule.kt:17)
            at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
            at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
            at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
            at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
            at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
            at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
            at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
            at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
            at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
            at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
            at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
            at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
            at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:112)
            at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
            at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:40)
            at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:60)
            at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.base/java.lang.reflect.Method.invoke(Method.java:568)
            at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
            at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
            at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
            at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
            at jdk.proxy1/jdk.proxy1.$Proxy2.processTestClass(Unknown Source)
            at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
            at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
            at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
            at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
            at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
            at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
            at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
            at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
            at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
    

    Similar problem but probably caused by the same reason I face in my personal project, but there the error is:

    java.lang.NoSuchMethodError at SparseImmutableTable.java:85

    Expected behavior
    recordParaprazziDebug works as normal

    Additional information:

  • Paparazzi Version: 1.3.1
  • OS: MacOS: Ventura 13.6
  • Compile SDK: 33
  • Gradle Version: 8.3
  • Android Gradle Plugin Version: 8.1.1
  • Basing on research it is related to guava version.
    I tried to exclude from konsist guava, but it do not work.

    Are there any other options to fix it?