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.

Dagger 2.2 to 2.3 (or 2.4)

See original GitHub issue

I have updated my Dagger version from 2.2 to 2.3 and now facing following problem:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'. java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSetMultimap$Builder.putAll(Ljava/lang/Iterable;)Lcom/google/common/collect/ImmutableSetMultimap$Builder;

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:48

github_iconTop GitHub Comments

8reactions
tbroyercommented, Apr 10, 2016

Looks like I was right then: add apt 'com.google.guava:guava:19.0' just above dagger-compiler and it now compiles without error.

Before:

$ ./gradlew app:dependencies --configuration=apt
Incremental java compilation is an incubating feature.
:app:dependencies

------------------------------------------------------------
Project :app
------------------------------------------------------------

apt
+--- com.google.dagger:dagger-compiler:2.3
|    +--- com.google.dagger:dagger:2.3
|    |    \--- javax.inject:javax.inject:1
|    +--- com.google.dagger:dagger-producers:2.3
|    |    +--- com.google.dagger:dagger:2.3 (*)
|    |    \--- com.google.guava:guava:19.0
|    \--- com.google.guava:guava:19.0
+--- com.android.support:appcompat-v7:23.2.0
|    +--- com.android.support:support-v4:23.2.0
|    |    \--- com.android.support:support-annotations:23.2.0
|    +--- com.android.support:animated-vector-drawable:23.2.0
|    |    \--- com.android.support:support-vector-drawable:23.2.0
|    |         \--- com.android.support:support-v4:23.2.0 (*)
|    \--- com.android.support:support-vector-drawable:23.2.0 (*)
+--- com.google.dagger:dagger:2.3 (*)
\--- org.glassfish:javax.annotation:10.0-b28

(*) - dependencies omitted (listed previously)

BUILD SUCCESSFUL

Total time: 0.641 secs

After:

$ ./gradlew app:dependencies --configuration=apt
Incremental java compilation is an incubating feature.
:app:dependencies

------------------------------------------------------------
Project :app
------------------------------------------------------------

apt
+--- com.google.guava:guava:19.0
+--- com.google.dagger:dagger-compiler:2.3
|    +--- com.google.dagger:dagger:2.3
|    |    \--- javax.inject:javax.inject:1
|    +--- com.google.dagger:dagger-producers:2.3
|    |    +--- com.google.dagger:dagger:2.3 (*)
|    |    \--- com.google.guava:guava:19.0
|    \--- com.google.guava:guava:19.0
+--- com.android.support:appcompat-v7:23.2.0
|    +--- com.android.support:support-v4:23.2.0
|    |    \--- com.android.support:support-annotations:23.2.0
|    +--- com.android.support:animated-vector-drawable:23.2.0
|    |    \--- com.android.support:support-vector-drawable:23.2.0
|    |         \--- com.android.support:support-v4:23.2.0 (*)
|    \--- com.android.support:support-vector-drawable:23.2.0 (*)
+--- com.google.dagger:dagger:2.3 (*)
\--- org.glassfish:javax.annotation:10.0-b28

(*) - dependencies omitted (listed previously)

BUILD SUCCESSFUL

Total time: 0.652 secs

As you can see, we now have Guava 19.0 before dagger-compiler, so we’ll use com.google.common.collect.ImmutableSetMultimap from Guava 19.0 rather than from dagger-compiler (which is actually Guava 18.0)

6reactions
ronshapirocommented, Apr 21, 2016

Dagger 2.4 has been released and should have this issue fixed, so if you added the apt 'com.google.guava:guava:19.0' you should be able to remove it now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Dagger 2 for dependency injection in ... - Vogella.com
Dagger 2 is dependency injection framework. It is based on the Java Specification Request (JSR) 330. It uses code generation and is based...
Read more >
dagger 2.0 javadoc (com.google.dagger)
This package contains the public API for the Dagger 2 dependency injection framework. By building upon JSR 330, Dagger 2 provides an annotation-driven...
Read more >
Dagger 2
Dagger is a fully static, compile-time dependency injection framework for both Java and Android. It is developed by the Java Core Libraries Team...
Read more >
Android MVP with Java, RxJava, Retrofit 2 and Dagger 2 For ...
Design Architecture has been around for a while now, and in this post I will try to explain how to use Dagger 2,...
Read more >
NoClassDefFoundError When Using Dagger 2 After Switching ...
try to add class path "com.google.dagger:dagger:2.4" to the main project's build.gradle. NOTE: keep version number same as moudule's build.
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