6

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.

image Android Studio's Device File Explorer

I've tried adb shell run-as and I am able to see files with ls
adb shell run-as

May I get some help how to setup Android Studio to use Device File Explorer properly?

adatadoc
  • 169
  • 1
  • 7

2 Answers2

6

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. Device File Explorer screenshot

adatadoc
  • 169
  • 1
  • 7
  • I am also facing the same issue.. is uninstalling secure folder the only way? – abby Dec 05 '22 at 12:33
  • 2
    Here is another question about same problem. https://stackoverflow.com/questions/74597521/android-studio-device-file-explorer-stop-working Currently no other solution is known. – adatadoc Dec 06 '22 at 15:15
  • 1
    Not working after uninstalling of Secure folder as well – Lovekesh Dec 12 '22 at 11:16
  • 1
    Its working. Also anyone thinking where to find secure folder app if uninstalled, its just like re-enabling in your settings, dont worry. – abby Dec 15 '22 at 04:19
  • Release 2023-01-19 - I've installed Release 2023-01-19, but the issue remained Build Number : A525FXXU4CWA2Android version : T(Android 13)Release Date : 2023-01-19Security patch level : 2023-01-01 – adatadoc Jan 27 '23 at 15:00
  • This has not only to do with Secure folder. It hapens also when you have a work Profile. The option--user 0 would help here but don't know if there is a way to set it for the file explorer. – S. A. Kıyak Apr 25 '23 at 19:43
1

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 -

  1. Get the user id - 'adb shell pm list users' (mostly the id will be '0' for the default user, which was my case.)

  2. 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

Shubham Nanche
  • 130
  • 2
  • 11
  • 1
    I tried this solution on Android 13 but unfortunately it didn't work for me – adatadoc Apr 14 '23 at 20:09
  • The perfect solution is somewhere near my solution because momentarily I was able to access the secure folders in my physical device on android studio. But, later when the connection between my device and the android studio got lost, I wasn't able to access them when I reconnected them. – Shubham Nanche Apr 15 '23 at 06:41