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

Upgrade androidx.test.uiautomator:uiautomator to 2.3.0 to fix issue #398 #490

Closed
xiaoPierre opened this issue Dec 2, 2022 · 22 comments
Closed

Comments

@xiaoPierre
Copy link
Contributor

xiaoPierre commented Dec 2, 2022

Hello,

I ran into the same issue as #398, and I see that the issue submitted to google has been resolved in version 2.3.0 (here's the release notes).

Could we upgrade androidx.test.uiautomator:uiautomator to 2.3.0 to fix this long-lasting issue ? (It seems that write permission is not open for the repository..) Thanks in advance !

cc @mykola-mokhnach @KazuCocoa as you followed similar issues before.

[update by KazuCocoa]
Moved to appium/appium#19597

@mykola-mokhnach
Copy link
Contributor

feel free to open a PR. you need to fork the current repository in order to do that.

@mykola-mokhnach
Copy link
Contributor

Also it's an alpha version. Do you think it is a good idea to include it into the release before it stabilizes?

@xiaoPierre
Copy link
Contributor Author

Oh indeed it's still alpha01, probably it's better to wait for official stabilised release of 2.3.0 after several months, but I'll try and test if the fix works in a separate fork.

(we're still using appium 1 so I hope it would easy to upgrade this library in appium 1 in our fork😃)

@xiaoPierre
Copy link
Contributor Author

xiaoPierre commented Dec 5, 2022

For info I just validated the fix with the new 2.3.0-alpha01 version with a local appium build, the buttons at the bottom of screen now have correct size. (screenshot taken from appium inspector)

Before the fix :
image

After the fix :
image

Note : I had a small issue in code when I do the upgrade, and I opened an issue here #491

@Comeodore
Copy link

Comeodore commented Dec 24, 2023

@KazuCocoa @xiaoPierre Any updates with it? Maybe we can upgrade to 2.3.0 beta?

@xiaoPierre mb can u share how u install locally uiautomator 2.3.0 alpha/beta?
Can i use this with actual appium-uiautomator-server?

@KazuCocoa
Copy link
Member

It looks like the lib changed to beta recently https://developer.android.com/jetpack/androidx/releases/test-uiautomator

@Comeodore
Copy link

It looks like the lib changed to beta recently https://developer.android.com/jetpack/androidx/releases/test-uiautomator

Can u update lib in project to 2.3.0 beta?

@mykola-mokhnach
Copy link
Contributor

Lets create a PR and see how the CI results look like with this beta

@KazuCocoa
Copy link
Member

Basically, we've been waiting for the stable version release.

You can manually modify this branch directly and create the server as https://github.com/appium/appium-uiautomator2-server?tab=readme-ov-file#building-project . Then once you replace existing apk in

const SERVER_APK_PATH = path.resolve(__dirname, 'apks', `appium-uiautomator2-server-v${version}.apk`);
with the buit apk, the new apk will be picked up.

@Comeodore
Copy link

@KazuCocoa @mykola-mokhnach UiAutomator devs depredecate getDefaultDisplay method
Now this is getDisplay(int), can u help me with changing it for my local using?
https://developer.android.com/reference/android/hardware/display/DisplayManager#getDisplay(int)

@KazuCocoa
Copy link
Member

KazuCocoa commented Dec 27, 2023

Do you mean https://developer.android.com/reference/android/view/WindowManager#getDefaultDisplay() ?

This method was deprecated in API level 30.
Use Context#getDisplay() instead.

https://developer.android.com/reference/android/content/Context#getDisplay()

return (Display) invoke(getMethod(UiDevice.class, "getDefaultDisplay"), Device.getUiDevice());

Updated
#585 ?

@Comeodore
Copy link

@KazuCocoa
With ur last changes on 2.3.0-beta01 version of uiautomator
image

@KazuCocoa
Copy link
Member

KazuCocoa commented Dec 29, 2023

Perhaps #585 change helps. We haven't verified the latest deps version, so possibly the version has compatibility issues.
Please report such new issues with newer dependencies we should update in https://github.com/appium/appium 's bug template.

@KazuCocoa
Copy link
Member

KazuCocoa commented Dec 30, 2023

For your case, it looks like the latest 2.3.0-beta01 package dropped the getDefaultDisplay, so all OS versions should follow #585 , thus it is a breaking change in uia 2.3.0 beta01 since their alpha.

@KazuCocoa
Copy link
Member

#588 is a fix for the beta01

@Comeodore
Copy link

@KazuCocoa Thanks, its working, but now when i trying to click on element, has trouble like this

E       selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot create UiObject2 instance with 'null' selector
E       Stacktrace:
E       io.appium.uiautomator2.common.exceptions.UiAutomator2Exception: Cannot create UiObject2 instance with 'null' selector

Any thoughts?

@KazuCocoa
Copy link
Member

No, just we need to test well and fix them.
Early alpha maybe did not have such issues, so probably you could use early alpha version.

@Comeodore
Copy link

@KazuCocoa The same trouble on 2.3.0-alpha01

@KazuCocoa
Copy link
Member

Then we should test the library carefully and update code. I guess we should update the base sdk version first, and wait for upcoming beta to see if it is intended changes in the lib or possible issue in the version.

@Comeodore
Copy link

@KazuCocoa Okay, please keep me posted, because fixing the screen size is very important for me (and judging by the many questions on various resources, not only for me)

@KazuCocoa
Copy link
Member

Sure, then, please create a new issue in the main appium repository so that we can track issues easier for future investigation.

@KazuCocoa
Copy link
Member

appium/appium#19597 will be the primary (instead of this issue) place to link GitHub issues, but as #490 (comment), it would be helpful to create separate issue for different behavior. Then I'll keep linking them to the primary issue'

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

No branches or pull requests

4 participants