How to examine SharedPreferences from adb shell?

前端 未结 8 718
傲寒
傲寒 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:08

    First pull shared preferences file from device. This requires root permision.

    adb pull /data/data/org.test/shared_prefs/MyKeys.xml MyKeys.xml
    

    Now MyKeys.xml is stored in current directory of your system.

    Modify values by

    vim MyKeys.xml
    

    After editing file save changes and push to device.

    adb push MyKeys.xml /data/data/org.test/shared_prefs/MyKeys.xml
    

    To Verify your changes

    adb shell
    cat /data/data/org.test/shared_prefs/MyKeys.xml
    

提交回复
热议问题