How to access sqlite DB on the Xoom?

你离开我真会死。 提交于 2019-12-25 08:59:06

问题


I have a Nexus One (rooted) and a Xoom (stock, not rooted). I have developed on my Nexus for quite some time, without any problems. I'm facing one with the Xoom, however, as it is not rooted.

Indeed, I use sqlite databases in my apps, and I would like to debug them using sqlite3 as I do on my Nexus.

It doesn't work!

$ pwd
/
$ id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),3001(net_b_admin),3002(net_bt),3003(inet)
$ sqlite3 /data/data/org.bicou.newsreader/databases/subscriptions.db
sqlite3: permission denied

I can't! How come? How am I supposed to develop? I'm sure I'm missing something but I don't know what.

Also, adb pull doesn't want to pull, and cat / cp / mv don't work either. I don't want to write specific code in my app just to browse the DB...


回答1:


If it is your app you're debugging, there is no need to root the device.

Edit this list of commands to your package name and db file name, and paste it into a shell:

adb wait-for-device shell <<EOF
run-as [YOUR_PNAME] 
chmod 666 databases/[YOUR_DB_FILE_NAME].db
exit
exit
EOF

adb pull /data/data/[YOUR_PNAME]/databases/[YOUR_DB_FILE_NAME].db
sqlitebrowser [YOUR_DB_FILE_NAME].db &

The sqlitebrowser can be replaced with whatever sqlite3 application you have on your pc.




回答2:


I rooted my device as well. But new system image doesn't have sqlite3 in path.




回答3:


I ended up rooting the device.

(answser input only for marking it as accepted)



来源:https://stackoverflow.com/questions/5888982/how-to-access-sqlite-db-on-the-xoom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!