简体   繁体   English

无法在 adb shell 上列出文件

[英]Fail to list files on adb shell

i'm trying to access my database file from adb shell, but sqlite3 cant open it, i think this is because i dont have root, searching on the web i found that to get root acess you need to:我正在尝试从 adb shell 访问我的数据库文件,但 sqlite3 无法打开它,我认为这是因为我没有 root,在网上搜索我发现要获得 root 访问权限,您需要:

adb root ->adbd is restarted as root(dont really know what is this)
adb connect <device>
adb -s <device> shell

this commands work fine here, but i still cant get root access and still cant acess my database file这个命令在这里工作正常,但我仍然无法获得 root 访问权限并且仍然无法访问我的数据库文件

The error i'm getting is:我得到的错误是:

Error: unable to open database "ClientsInfoDB.db": unable to open database      file 1

on my app code to create the database i use:在我的应用程序代码上创建我使用的数据库:

    public DatabaseHelper(Context context){
    super(context, "ClientsInfoDB", null, 2);

can anyone help me here?有人能帮我一下吗? thanks for attention谢谢关注

EDITED --- Important informations that was missing(sorry for that :s): i'm using Blluestacks to run my app已编辑 --- 缺少重要信息(对此表示抱歉:s):我正在使用 Blluestacks 来运行我的应用程序

To access the app directory i did(on the shell):要访问我所做的应用程序目录(在外壳上):

cd data/data/<my_package_name>/databases
ls --> wont work
sqlite3 ClientsInfoDB
.databases --> message error that i posted above

If you're using a standard version of Android (ie not AOSP) you won't be able to get root by default.如果您使用的是标准版本的 Android(即不是AOSP),则默认情况下您将无法获得 root。 The steps for rooting the phone vary based on manufacturer and version and sometimes you can find instructions online.手机生根的步骤因制造商和版本而异,有时您可以在网上找到说明。 That said, it's not something that is officially supported and may damage your phone.也就是说,它不是官方支持的东西,可能会损坏您的手机。

That said, without doing that, you can't access your application's database without root because the data directory for your application is restricted to your application only.也就是说,如果不这样做,没有 root 用户就无法访问应用程序的数据库,因为应用程序的数据目录仅限于您的应用程序。 If you need to access it, try having your application store the database somewhere like the /sdcard or equivalent directory which is generally accessible.如果您需要访问它,请尝试让您的应用程序将数据库存储在诸如/sdcard或通常可访问的等效目录之类的地方。 The downside to this is that any application can access it, so be careful what you put there in production.这样做的缺点是任何应用程序都可以访问它,因此请注意您在生产中放置的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM