How to examine SharedPreferences from adb shell?

前端 未结 8 704
傲寒
傲寒 2021-01-30 10:30

Now that we can Examining sqlite3 Databases from a Remote Shell, is it possible to examine SharedPreferences from adb shell? Since it would be much more convenient to examine an

相关标签:
8条回答
  • 2021-01-30 11:22

    Helper bash function

    function adb-pull-prefs {
        # ${1} - app package
        # ${2} - prefs name
        adb exec-out run-as ${1} cat /data/data/${1}/shared_prefs/${2}.xml
    }
    
    0 讨论(0)
  • 2021-01-30 11:24

    In case anyone else is running into "Permission Denied" errors using all of the above suggestions like I was, you may need to use exec-out like this:

    adb exec-out run-as <package.name> cat /data/data/<package.name>/shared_prefs/<package.name>_preferences.xml
    
    0 讨论(0)
提交回复
热议问题