-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Hamcrest old version causes: java.lang.NoSuchMethodError: No static method allOf #357
Comments
@rsavin Hi Roman! Thanks for the report.
If both versions are not compatible, we won't be able to update Hamcrest until Espresso does it first. And even if the build would work, we shouldn't because we might break other projects out there not using 2.2. |
Closing for inactivity |
We got the same issue. Espresso 3.4.0 uses hamcrest-library 2.2, which causes compile errors due to incompatibility with harmcrest 1.3. |
Hello @shuhart! 👋 Just to clarify: if you used the latest version of Espresso, you would have the same issue, right? And you are using Hamcrest 1.3, aren't you? Maybe you should move from Hamcrest 1.3 to 2.2 and that's it? |
Sorry! I didn't read you well. You are on 2.2 and Espresso is on 1.3. Are you on 2.2 for any special reason? May you move to 1.3 or there's any special case 1.3 is not able to handle? |
We don't use harmcrest internally. The problem is that Barista depends on harmctest 1.3, that's why the only thing we can do is to downgrade either Espresso or harmcrest (using gradle hacks) or just get rid of Barista. |
Oh, if you don't use Hamcrest, why don't you just remove your Hamcrest dependency? And you could also remove the dependency on Espresso, and just depend on Barista. As Barista depends on both, it's the only dependency you need. Please, give it a try :·) |
Doesn't sound like a good idea. Probably just going to get rid of Barista.
…On Wed, Jul 7, 2021, 12:46 Roc Boronat ***@***.***> wrote:
Oh, if you don't use Hamcrest, why don't you just remove your Hamcrest
dependency? And you could also remove the dependency on Espresso, and just
depend on Barista. As Barista depends on both, it's the only dependency you
need.
Please, give it a try :·)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#357 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIPHPR6SH2KZJGZ3L4VZ6TTWQO7VANCNFSM4PNKNJNQ>
.
|
I think having dependencies you don't use is not too wise, but you choose. Thanks for the feedback, though! 👍 |
If you're not using Hamcrest, it does sound like a great idea. You should not declare dependencies that you're not going to use. If other libraries require Hamcrest, they will pull the right version already. That's how transitive dependencies work :) |
I don't get you. We use Espresso and Barista. And we don't want to
downgrade Espresso just so Barista would work as it depends on the older
version of it.
…On Wed, Jul 7, 2021, 12:50 Roc Boronat ***@***.***> wrote:
Closed #357 <#357>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#357 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIPHPXQOU2MHP4FEVTH5PDTWQPPDANCNFSM4PNKNJNQ>
.
|
@shuhart I think (someone correct me if I'm wrong) the suggestion is to remove the explicit dependency on Espresso, given that Barista already depends on it and will pull it into the tree. The problem will come if you depend on anything in Espresso in a more recent version than that which is currently pulled in by Barista (v3.1.1 I think). Then it gets a bit awkward. In my case, I ran into this issue, but then noticed that I'd explicit dependencies on espress which I didn't need. Removing them fixed it. Is there an existing Barista issue for updating the espresso dependency for those who do need it? |
Now we're working on publishing the latest version of Barista to Android Central. Then, we'll go back to common things like using the latest Espresso version. Sorry for the delay! By the way, in case @shuhart doesn't do anything special only the latest version of Espresso handles, removing the dependencies and relying on Barista just works 😄 Thanks for your comment, too! Happy you were in the same situation and fixed it just removing your Espresso dependency. |
Ok, thanks for the update
…On Wed, Jul 7, 2021, 13:14 Roc Boronat ***@***.***> wrote:
Now we're working on publishing the latest version of Barista to Android
Central. Then, we'll go back to common things like using the latest
Espresso version. Sorry for the delay!
By the way, in case @shuhart <https://github.com/shuhart> doesn't do
anything special only the latest version of Espresso handles, removing the
dependencies and relying on Barista just works 😄
Thanks for your comment, too! Happy you were in the same situation and
fixed it just removing your Espresso dependency.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#357 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIPHPWETRPHCI5HAIUSQETTWQSI3ANCNFSM4PNKNJNQ>
.
|
Hi @shuhart! Even the latest version of Espresso uses Hamcrest 1.3, so it's not an issue with Barista. Another library must be importing Hamcrest 2.2. You can check which dependency is pulling Hamcrest 2.2 by running a Gradle scan or using the If you remove Barista, you can still have the same error if you use any Espresso matcher that uses a Hamcrest method that doesn't exist in 2.2. I'm not sure that there's a fix for that :/ |
espresso-contrib depends on accessibility-test-framework which depends on hamcrest-2.2 |
We already have a temporary solution for that, I just wanted to point out the issue with you library (was not seeking a solution or advices on how to fix the issue). |
Ah! Good to hear! |
Hello, I got the same problem in my project. it appears that the version of hamcrest is declared strictly to version Only solution, I found is to downgrade to version Do you have another solution ? Because this is annoying to use this old version of expresso. Do you know when it will be fixed on your side ? (Update the version of expresso used by the library) Thanks ! |
This does not fix the essential problem which is actually Google's fault. Augmenting what @shuhart wrote above: barista 4.2.0 depends on So then the only solution for anything using espresso-contrib, including Barista, is to force the strict downgrade to accessibility-test-framework 2.1 which depends instead upon hamcrest core & library 1.3, the same version used by espresso-core 3.4.0 The following gradle code fixes it for me using Espresso 3.4.0 and Barista 4.2.0. androidTestImplementation ('com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework') {
// !!! prevent 3.1 which pulls hamcrest 2.2, breaking espresso-core and Barista
version { strictly '2.1' }
}
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0' |
So finally this dependency fixed all the errors: androidTestImplementation "org.hamcrest:hamcrest:2.2" 💃🏼 |
@RahulSDeshpande why androidTestImplementation "org.hamcrest:hamcrest:2.2" would fix it? |
Please consider making a Pull Request if you are capable of doing so.
Library Version:
3.5.0
Describe the Bug:
When I use the
assertListItemCount(R.id.list, 5)
method and some other methods from Barista I get the following exception:I did some investigation and the problem is that we have Hamcrest v2.2 in our project and Barista uses Hamcrest v1.3 which comes transitively from Espresso dependencies. If I downgrade Hamcrest to v1.3 in the project dependencies it works fine.
Is it possible to start using Hamcrest v2.2 in Barista to make it possible to use in project with the updated library? I can open a PR if it's fine for you to get updated.
Steps to reproduce the bug:
Expected Behavior:
The text was updated successfully, but these errors were encountered: