pidcat icon indicating copy to clipboard operation
pidcat copied to clipboard

Getting package list with "ls /data/data" not working on recent Android versions

Open kmansoft opened this issue 3 years ago • 1 comments

I'm not getting autocompletion for package names with Android 12 emulator.

The reason is that this command fails:

adb $device_selected shell ls /data/data 2>/dev/null

because of a permissions issue:

adb shell ls /data/data
ls: /data/data: Permission denied

This replacement works fine for me:

local apks=$(adb $device_selected shell pm list packages 2>/dev/null | sed "s/package://g" | tr '\n' ' ' | tr -d '\r')

kmansoft avatar May 25 '22 17:05 kmansoft

I had no idea the completions were using that method. They were both contributed code. Obviously going through the package manager is the right way.

JakeWharton avatar May 25 '22 17:05 JakeWharton