如何使用 Android Studio 查看共享首选项文件? [英] How can I view the shared preferences file using Android Studio?

查看:43
本文介绍了如何使用 Android Studio 查看共享首选项文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用共享首选项为我的应用存储某些值.我想查看信息实际存储在我手机上的文件.我在 Eclipse 上找到了很多方法来做到这一点,但我正在 Android Studio 上进行调试.我的手机已经root了.我读到拥有 root 访问权限对于读取这些类型的文件很重要.如果没有办法,那么我将查找如何通过我的程序访问信息然后将其输出到日志cat.不过,希望我可以直接在手机上查看文件,因为它要简单得多.谢谢.

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 Eclipse, but I'm debugging on Android Studio. My phone is rooted. I read that having root access is important to read these types of files. If there is no way, then I will look up how to access the info through my program then output it to log cat. Hopefully, though, I can just view the file on the phone directly as it is much simpler. Thanks.

推荐答案

作为 Android Studio 3.x 一部分的设备文件资源管理器非常适合探索您的首选项文件、缓存项目或数据库.

The Device File Explorer that is part of Android Studio 3.x is really good for exploring your preference file(s), cache items or database.

  1. 共享偏好/data/data//shared_prefs 目录

看起来像这样

打开设备文件资源管理器:

To open The Device File Explorer:

单击查看">工具窗口">设备文件资源管理器"或单击工具窗口栏中的设备文件资源管理器"按钮.

Click View > Tool Windows > Device File Explorer or click the Device File Explorer button in the tool window bar.

这篇关于如何使用 Android Studio 查看共享首选项文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆