简体   繁体   English

sqlite3权限被拒绝android

[英]sqlite3 permission denied android

I'm trying to access the database of the application I'm developping directly on my Nexus, but I get a "permission denied" when I tried to execute the "sqlite3" command. 我正在尝试访问我正在我的Nexus上直接开发的应用程序的数据库,但是当我尝试执行“sqlite3”命令时,我得到了“权限被拒绝”。 I also tried to start the adb in root mod, but again, permission denied on the device... I guess I will have to do that with the emulator but I have a lot of data to load and it would have been 10 times faster with the phone on Wifi than the emulator... Unless someone has any idea? 我也尝试在root mod中启动adb,但是再一次,设备上的权限被拒绝...我想我将不得不用模拟器做到这一点但是我有很多数据要加载它会快10倍Wifi上的手机比模拟器...除非有人有任何想法? thanks 谢谢

I struggled with this for a while, so here's my solution, which works on an unrooted device: 我挣扎了一段时间,所以这是我的解决方案,它适用于无根设备:

#!/bin/sh

# fill these values in
PACKAGE=com.example.android
DB=something.db 

# copy db to sdcard using package permission (using cat because no cp    command)
adb shell "run-as $PACKAGE cat /data/data/$PACKAGE/databases/$DB >   /sdcard/$DB"

# pull file from sd card
adb pull /sdcard/$DB

# do something with it (need to install sqlitebrowser obviously)
sqlitebrowser $DB

文件被读取保护,您需要root您的手机或使用模拟器。

Typical. 典型。

I worked around this annoyance by adding a feature to my app that backs up (copies) the DB to the SD card. 我通过在我的应用程序中添加一个功能来解决这个烦恼,该功能将数据库备份(复制)到SD卡。 adb pull works against any sdcard files. adb pull适用于任何SD卡文件。

EDIT: fixed "adb" misspelling (was "sdp". 编辑:修复“adb”拼写错误(是“sdp”。

I had a similar problem. 我遇到了类似的问题。 I pulled sqlite3 from emulator and pushed in on my device and couldn't run it - permission denied. 我从模拟器中取出sqlite3并将其推入我的设备并且无法运行它 - 权限被拒绝。

Apparently sqlite3 binary didn't have execute permission (-rw-rw-rw-) so chmod +x sqlite3 solved the issue. 显然sqlite3二进制文件没有执行权限(-rw-rw-rw-)所以chmod + x sqlite3解决了这个问题。

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

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