Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

android - How to access sqlite DB on the Xoom?

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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...