How can I view the shared preferences file using Android Studio?

前端 未结 14 1031
甜味超标
甜味超标 2020-11-27 11:33

I\'m using shared preferences to store certain values for my app. I would like to see the file where the info is actually stored on my phone. I found many ways to do this on

14条回答
  •  温柔的废话
    2020-11-27 12:08

    Stetho

    You can use http://facebook.github.io/stetho/ for accessing your shared preferences while your application is in the debug mode. No Root

    features:

    1. view and edit sharedpreferences
    2. view and edit sqLite db
    3. view view heirarchy
    4. monitor http network requests
    5. view stream from the device's screen
    6. and more....

    Basic setup:

    1. in the build.gradle add compile 'com.facebook.stetho:stetho:1.5.0'
    2. in the application's onCreate() add Stetho.initializeWithDefaults(this);
    3. in Chrome on your PC go to the chrome://inspect/

    UPDATE: Flipper

    Flipper is a newer alternative from facebook. It has more features but for the time writing is only available for Mac, slightly harder to configure and lacks data base debugging, while brining up extreamely enhanced layout inspector

    You can also use @Jeffrey suggestion:

    • Open Device File Explorer (Lower Right of screen)
    • Go to data/data/com.yourAppName/shared_prefs

提交回复
热议问题