New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.3: NoSuchMethodError ImmutableList.sortedCopyOf #5147
Comments
Looks like .ImmutableList.sortedCopyOf API was introduced in guava 21 Try to ensure your build is picking up at least com.google.guava:guava:27.0.1-jre. |
I am facing this same issue. I don't have any dependency on @schroederm were you able to resolve this issue? |
Sorry for not updating this here. Seems a bit strange to me that a dependency to it was seemingly added without resolving it at framework level. |
So are you saying we should add |
What I'm saying is I added |
wow, looks like this is working. I have been banging my head for 3 days. Thanks for the solution 👍 🎆 |
Sure thing, thanks for reminding me to add the answer here. |
super man.. u saved my life... |
I am facing this same issue. I also don't have any dependency on com.google.guava:guava in my project.
|
Does your project depend on jar files without using gradle? Seems like there could be multiple gradle versions on your classpath and it is using an older one. |
I'm able run unit test through test runner and getting coverage as well. However when I try to run with JaCoCo through CLI
I'm using
Please help me resolve! |
This is happening because there is more than one version of Guava on your classpath. One of them is being included by Gradle, and the other is likely part of some other jar file. You need to iterate over your jar file dependencies and figure out where the other guava is coming from, and then remove that. |
@Prat-JD you can follow https://stackoverflow.com/questions/21645071/using-gradle-to-find-dependency-tree to check your app's dependencies, and find which dependency uses different guava version. You can try to update this dependency or exclude specific guava from this dependency. |
I am also facing Issue
app/build.gradle
Even I added the Solution proposed by adding
Then I also faced the following the issue
|
@manishkummar21 I was getting this issue because there were multiple different version of guava available in my project. One of them was from .jar file and few from gradle dependencies. As @utzcoz and @hoisie mentioned, you need to find out through dependency tree and remove. Try to keep only one guava version if possible. |
Yes my project depend on jar files, i could not figure out whether there is different version of Guava or not . i looked at previous answers but i could not figure out. |
Description
We've been running robolectric 4.1 flawlessly in our project. When we try to upgrade to 4.3, a lot of tests fail with the following output:
java.lang.NoSuchMethodError: com.google.common.collect.ImmutableList.sortedCopyOf(Ljava/util/Comparator;Ljava/lang/Iterable;)Lcom/google/common/collect/ImmutableList;
Is this a problem on our side; if so, any suggestions to fix it?
Steps to Reproduce
Change our build.gradle to include
testImplementation 'org.robolectric:robolectric:4.3'
Robolectric & Android Version
Robolectric 4.3
compileSdkVersion 28
minSdkVersion 16
targetSdkVersion 28
The text was updated successfully, but these errors were encountered: