-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
adb shell cmd list packages fails while creating driver session #810
Comments
I assume the issue might have to do with the fact the device is included into an MDM profile. |
I've added the workaround to uia2 driver v3.7.6 |
Thank you for the swift resolution. In the meantime I already did some googling and uninstalled It resolved the issue for me, and now it is working with UiAutomator2 driver version 3.5.2. I will check with the driver version 3.7.6 while having Secure Folder installed and see it works. |
This issue definitely has to do with some Android internals, in particular the package manager service logic and permissions. UIA2 driver is a simple/dumb CLI client in that scenario. |
Works with version 3.7.6 when Seucre Folder is installed on Samsung devices. Here are appium server logs where it apparently retries with appending
For driver versions below than 3.7.6, I tested with uninstalling Secure Folder and it also works fine. When Secure Folder is installed it gives the same error with incremented user i.e.
Since I want to keep the driver versions in sync with the driver versions of cloud provider so I do not encounter any issues when testing locally due to driver version mismatch, I will keep using 3.5.2 and uninstall Secure Folder as I do not need it. Not sure if there is an easy way to have multiple driver versions installed, and use any specific version by providing the version as command line argument when starting appium. To uninstall the seucre folder on Samsung, here are the steps Big Thanks. |
Here are some more findings as to why having Secure Folder causes this issue which I came across while reading: Quoting the answer from below StackOverFlow response:- This error may be caused by the fact that some devices support multiple user accounts and adb attempts installing the build on all accounts. However, one of the users (user 150) cannot be manipulated from adb due to restricted privileges from the device manufacturers. This happened to me recently after updating my Samsung S21+ to OneUI 5, I could no longer run expo dev-client builds. I also updated my Samsung device recently (can't remember when) and am using Samsung One UI version 5.1 which may have caused this issue for me because the way newer version of UiAutomator2 driver executed ADB commands. |
Also in a comment to StackOverFlow, another user has pointed similar cause for this issue. Quoting Firelord's response to original question: Samsung has restricted privileges of adb (shell) user from making changes to packages installed under user 150. There is nothing we can do. This is a design choice (probably to ensure bloat continues to float in the device). Rooting is the only solution to remove bloatware in such situations. |
I have recently upgraded my Appium UiAutomator2 driver version from 2.42.1 to 3.5.2, and I encountered following error when I try to create the instance of AndroidDriver with UiAutomator2.
USB debugging under Developer options is already enabled and everything was working fine before upgrading driver version as follows:-
I have even tried by upgrading the Appium UiAutomator2 driver to latest version i.e. 3.7.5 but it still does not work and throws the same error. When I downgrade back to the UiAutomator2 version 2.42.1 then it starts working. Also I do not get this error on emulator or when using cloud provider real devices.
I have gone through the similiar issue raised here appium/appium#20324 but I do not have the same developer mode settings, and i have Samsung device and the problem only happend locally on my real device when I use driver version 3.5.2 or higher.
Client side error
Appium Server logs
When I try to manually execute following command directly with
user 0
then it worksadb shell cmd package list packages --user 0
but otherwise it does not work. I do not understand where this problem has come from after updating driver version despite having same device and device settings.
Environment:
Appium server 2.6.0
Appium UiAutomator driver 3.5.2
Appium Java client 9.3.0
Samsung Galaxy S20 - Android 13.0 (real device)
The text was updated successfully, but these errors were encountered: