Skip to content
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

fix: Changes in build.gradle dependencies to overcome Resources$NotFoundException #610

Conversation

rasim-sitmanbetov
Copy link
Contributor

@rasim-sitmanbetov rasim-sitmanbetov commented Sep 28, 2020

Hi,

Next few changes required for integration of espresso-server with our AUT to overcome Resources$NotFoundException.

These changes look to be AUT specific, and unfortunately I'm not sure it won't affect integration of espresso-server with other AUTs, having different dependencies/versions.

Please consider the changes in this PR and lets compare them with changes having similar idea in the #596, https://github.com/appium/appium-espresso-driver/pull/506/files (apart from

androidTestImplementation("androidx.test.espresso:espresso-contrib:$espresso_version") {
        transitive = false
    }

which look to be common issue for all affected AUT). I've provided more details in the comment

rasim-sitmanbetov and others added 2 commits September 25, 2020 18:07
refactor: Allow target SDK 29 (appium#604)
…oidTestImplementation` to `implementation`

2. added dependency `androidx.lifecycle:lifecycle-extensions`
@KazuCocoa
Copy link
Member

Could you resolve the conflict?

@mykola-mokhnach mykola-mokhnach changed the title Changes in build.gradle dependencies to overcome Resources$NotFoundException fix: Changes in build.gradle dependencies to overcome Resources$NotFoundException Sep 28, 2020
@mykola-mokhnach
Copy link
Contributor

It looks like tests got unhappy after this change

@rasim-sitmanbetov
Copy link
Contributor Author

@mykola-mokhnach
the only change compared to the previous version with conflicts is version of com.google.android.material:material: 1.2.0 vs 1.2.1.
Do you think it might be the reason?

1) mobile
       mobile: navigateTo
         should call the navigateTo method:
     AssertionError: expected promise to be rejected with an error matching /Could not navigate to menu item 10/ but got '[execute("mobile: navigateTo",{"element":{"ELEMENT":"af3731f3-9118-4117-9278-b571854b9ee2"},"menuItemId":10})] Error response status: 13, , UnknownError - An unknown server-side error occurred while processing the command. Selenium error: An unknown server-side error occurred while processing the command. Original error: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/material/navigation/NavigationView;'

I'm not very familiar with those tests. Could you please give me a hint what could went wrong?

@mykola-mokhnach
Copy link
Contributor

mykola-mokhnach commented Sep 30, 2020

I would say it is an issue with the Google's implementation of navigateTo action. It requires com.google.android.material.navigation.NavigationView; to be imported. Although, I think this espresso server project itself should be importing as little modules as possible. That is why it would make sense to delete com.google.android.material from the gradle file and add it to the additionalAppDependencies config entry of this particular test.
Also, I'll add a better handler for such type of exceptions, so people know what to do when it happens

@howsyourface
Copy link

howsyourface commented Sep 30, 2020

We 100% need to get these application under test related dependencies out of there and use the mechanism provided. If that doesn't do it and it needs to be more configurable then we need to build in a bit more of a custom dependency management system into it.

This change has broken my apps.

We need the:

androidTestImplementation("androidx.test.espresso:espresso-contrib:$espresso_version") {
        transitive = false
    }

But need to remove:

androidTestImplementation "com.google.android.material:material:1.2.0"

As that material line seems to cause runtime exceptions in the application under test if it uses appcompat themes.

I've tested this change and it fixes my app, so I approve this message.

It would be nice if we could get this into a new build asap so there is a version for everyone to pull with the transitive problem fixed in it as well :)

@rasim-sitmanbetov
Copy link
Contributor Author

Considering comments of @mykola-mokhnach and @howsyourface and already opened PR #616, I think current PR should be closed.

FYI @grzegorz-jarosz as initially androidTestImplementation "com.google.android.material:material:1.2.0" was added in your PR #596. I think after PR #616 you will need to update your espressoBuildConfig with additionalAppDependencies

@grzegorz-jarosz
Copy link
Contributor

I was having some doubts adding 'material' dependency, but didn't want to break existing tests. If we can fix this particular test then I guess it's fine.
I'm glad there's a light in the tunnel to have it solved for our users and I agree that less imported modules is better.
@rasim-sitmanbetov : Thank you, will keep an eye on the updates.

@rasim-sitmanbetov rasim-sitmanbetov deleted the fix_app_dependencies_resource_not_found branch October 1, 2020 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants