Android Studio’s Device File Explorer stopped working properly after upgrading Samsung Galaxy A52 phone.
I’ve got error on data/data/ folders error executing shell command pm list
Details about Phone and Android Studio:
Galaxy A52 (SM-A525F)
Build Number : A525FXXU4CVJB
Android version : T(Android 13)
Release Date : 2022-11-21
Security patch level : 2022-11-01
One UI 5 Upgrade (Android 13)
link
ANDROID STUDIO
Build #AI-213.7172.25.2113.9123335,
built on September 30, 2022
Android Studio Dolphin | 2021.3.1 Patch 1
Runtime version: 11.0.13+0-b1751.21-8125866 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
I’ve tried adb shell run-as and I am able to see files with ls
May I get some help how to setup Android Studio to use Device File Explorer properly?
2
Answers
After I've uninstalled Secure Folder Anrdoid Studio works properly as before upgrade with Secure Folder installed. It's not a solution if you want to keep your Secure Folder but Device File Explorer can be used this way.
I don’t know if this would work for all, but it definitely worked for me, so I am sharing my way –
My device recently got upgraded to Android 13 from Android 12 (Xiaomi Redmi Note 10 Pro Max), and before that, I was able to access data/data folder via adb connection over Wi-Fi. But, when I tried to access the data/data folder, it popped this message – ‘error executing shell command pm’ below that folder. So, I did some research and found that the adb was trying to access my work profile, rather than my user profile.
I then switched the user via –
Get the user id – ‘adb shell pm list users’ (mostly the id will be ‘0’ for the default user, which was my case.)
Switch to default user – ‘adb shell am switch-user USER_ID’ (USER_ID = 0, in my case)
If you try to switch to work profile, you might get –
java.lang.SecurityException: Shell does not have permission to access user 10 at com.android.server.am.UserController.enforceShellRestriction(UserController.java:2625) at com.android.server.am.UserController.switchUser(UserController.java:1840)
If still you are not able to acces data/data folder, then uninstall/disable work profile or the app such as ‘Company Intune Portal’ or the app that you employer has asked you to get installed on your device and then do the above steps again. Hopefully, you may have regained access to the data/data or other folders that were not accessible before.
If that doesn’t work, try to ‘Revoke USB debugging authorizations’ in the ‘Developer Options’ and follow the above steps again.
Or, even if that doesn’t help you, try to restart both your PC and mobile device, and first disable Developer Options and Re-enable it again. Don’t forget to enable ‘USB debugging’.
You may try to kill the server and re-enable it, if none of the above works-
‘adb kill-server’
‘adb start-server’
‘adb devices’
Don’t forget to reinstall/enable what you had uninstalled/disabled 🙂
EDIT: After some time of hassleless usage, I am now getting the same error. If someone else has a better solution, please let us know.
EXTRA: To get the current user –
adb shell am get-current-user # returns USER_ID of the foreground user
adb shell cmd activity get-current-user # alternative command