I am just starting out developing on android and currently only code directly on my devices (both galaxy nexus and nexus 7) using the amazing app AIDE.

Looking on here there are lots of answers for pulling the DB onto your computer using adb, but I'm not using a computer.

I am seeing answers on building the app in debuggable mode and using 'run-as' but I get a no permission error. I don't have root and am not totally averse to putting it on but want to make sure there are no non-root ways to do this.

I'm trying the run-as stuff using connectbot.

Thanks in advance

有帮助吗?

解决方案

I don't have root and am not totally averse to putting it on but want to make sure there are no non-root ways to do this.

There are no non-root ways to do this without work on your end. One app (say, AIDE) has no rights to access the internal storage of another app (say, yours).

Non-root options include:

  • Adding a backup feature to your app that copies the database to external storage, at which point you can use apps like the aSQLiteManager mentioned in the previous post (also available directly on the Play Store).

  • Baking in some sort of SQLite editor into your app temporarily during development, removing it when you go to production.

其他提示

Tools like http://sourceforge.net/projects/asqlitemanager/ can read and write to local sql files locating on the sd card. (Without rooting the phone)
On rooted phone, lot of applications can read/write even to system DBs.

I would suggest not to put any important data on local DB without encrypting it first


Edit:
If I understand correctly, you have an SQLite application and you want to access your sqlite DB from outside of your application (but on your device)

If this is the case, I would try to have a "secret" option on my application (for debug version only) that will start an activity from external sqlite browser application.
Or you can have activity that copy your DB to a folder on the SD card, where you will be able to edit it easily
But what is that you really need?
Do you need to see the values only?
Do you need to check the structure?
Do you need full edit over the DB?
You might be able just to have a dump (writing to txt file on the SD card) the data without dealing with a full sqlite editor (based on your answer to those questions)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top