question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.NoSuchMethodError: com.google.common.base.Verify.verify

See original GitHub issue

Dagger 2.14.1 Perhaps more classes require shading?

...
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.ltgt.gradle.errorprone.ErrorProneCompiler.execute(ErrorProneCompiler.java:66)
	... 57 more
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodError: com.google.common.base.Verify.verify(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
	at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:158)
	at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:96)
	at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:90)
	at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:137)
	at com.google.errorprone.BaseErrorProneCompiler.run(BaseErrorProneCompiler.java:108)
	at com.google.errorprone.ErrorProneCompiler.run(ErrorProneCompiler.java:118)
	at com.google.errorprone.ErrorProneCompiler.compile(ErrorProneCompiler.java:65)
	... 62 more
Caused by: java.lang.NoSuchMethodError: com.google.common.base.Verify.verify(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
	at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:349)
	at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:342)
	at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:342)
	at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:244)
	at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:138)
	at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:47)
	at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
	at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:968)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:884)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2200(JavacProcessingEnvironment.java:108)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1204)
	at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1313)
	at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1267)
	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:943)
	at com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:100)
	at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:142)
	... 68 more

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

2reactions
jrodbxcommented, Jan 14, 2018

Looked into this some more. Bumping the version of Dagger 2 from 2.13 to 2.14.1 breaks when used in conjunction with the gradle-errorprone-plugin (v0.0.10). I had trouble reproducing locally at first, because I was omitting a flag that we set on CI which “applies” the gradle-errorprone-plugin.

Confirming @ronshapiro’s comment above, forcing Guava to 23.6-jre with the following snippet works:

        if (details.requested.group == 'com.google.guava') {
          details.useVersion '23.6-jre'
        }

When I diff my app dependencies with and without applying the errorprone-gradle-plugin on Dagger 2.13, then diff again (w/wo plugin) after bumping to Dagger 2.14.1, then diff those results, I get:

9,14c9
< <      |    \--- com.google.guava:guava:21.0 -> 23.6-jre
< <      |         +--- com.google.code.findbugs:jsr305:1.3.9 -> 3.0.0
< <      |         +--- org.checkerframework:checker-compat-qual:2.0.0
< <      |         +--- com.google.errorprone:error_prone_annotations:2.1.3 -> 2.0.21
< <      |         +--- com.google.j2objc:j2objc-annotations:1.1
< <      |         \--- org.codehaus.mojo:animal-sniffer-annotations:1.14
---
> <      |    \--- com.google.guava:guava:21.0
26c21
< <      +--- com.google.guava:guava:21.0 -> 23.6-jre (*)
---
> <      +--- com.google.guava:guava:21.0
28c23
< <      |    \--- com.google.guava:guava:19.0 -> 23.6-jre (*)
---
> <      |    \--- com.google.guava:guava:19.0 -> 21.0

However, Guava 19.0, 21.0 and 23.6-jre all have the same method declaration in Verify.java, i.e.,

verify(boolean expression, String errorMessageTemplate, @Object... errorMessageArgs)

One thing worth noting (since forcing Guava 23.6-jre works): the nullable annotations applied to this method signature changed from 23.5 to 23.6 in this commit: https://github.com/google/guava/commit/6f22af40e1526b8c194e9e36d457bcd37680c6a3

Could that be related?

1reaction
ronshapirocommented, Dec 21, 2017

Somewhere there’s an old version of Guava that’s being pushed on the annotation processor path. If I manually add this to the pom, the build succeeds:

             <artifactId>error_prone_core</artifactId>
             <version>2.1.1</version>
           </dependency>
+          <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>23.6-jre</version>
+          </dependency>
         </dependencies>
Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NoSuchMethodError: com.google.common.base ...
By updating the version of guice, the problem solved for me. You can check if there is another library using guava by "mvn...
Read more >
java.lang.NoSuchMethodError: com.google.common.base ...
Hi Team, I am Not able to run hive. Getting following error on hive version above 3.X, i tried all the versions. It...
Read more >
Verify (Guava: Google Core Libraries for Java 23.0 API)
Ensures that reference is non-null, throwing a VerifyException with a custom message otherwise. Methods inherited from class java.lang.Object · clone, equals, ...
Read more >
Spark writing to S3 failed: java.lang.NoSuchMethodError
Caused by: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object ...
Read more >
java.lang.NoSuchMethodError: com.google ... - Google Groups
What do you use to serve your web application ? Tomcat ? Perhaps you might want to check if there are any libraries...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found