Good morning,
I am developing offline storage for an Android mobile app and I would like to access and open its local database as I always did with web local development, possibly by using some sort of GUI software like DB Browser for SQLite.
I found out where the db file is but it is too much cumbersome exporting it from the Android file system (I tried the ADB backup + decrypt with zlib library way) from a dev point of view. Are there other modern ways?
I'm using Visual Studio Code as code editor.
How can I view the DB in IntelliJ to view its content and perform operations on it. Now I have created my tables etc but i have no idea what data is on the DB and I do not want to create queries in java to check it. seems like a slow workflow so ill wait til I know how to access the db that resides on the Android emulator im using.
Is it possible?
You can also use Stetho. A nice debugging tool from Facebook.
Just simple to use, initialize it in your Application class and access your sqlite and even shared preferences from Google Chrome's developer console.
You can create a database file outside of Android and use any tool to create and read it.
Then, you place it in the assets folder and setup your code to read the database from there instead of private app data. Caveat here is that a copy will be made from the assets folder to the app data, so any updates within the app won't be mirrored to the database file in the assets folder.
I believe you can access the DDMS window in Intellij/Android Studio and there is a Database Explorer there
see #alexsimo's answer.
Without root you cannot access your database on your device, unless the file is created with a+r permissions.
Since that is something that is unrelated to the issue, you can just search in plugin.jetbrains.com for sqlite and get a variety of plugins.
I am building my first Android app using Phonegap and the Phonegap app on my android tablet. It uses a SQLite DB. I want to be able to view some of the tables in the DB. I have rooted my tablet and installed several apps like SQLite Debugger, sqlite DB reader, file manager. None of them find the db. It is not listed under the Phonegap app or under the com.mydomain.app notation I set in the config.
Does anyone know where to find it?
Thanks
you can see in eclipse file explorer, com.mydomain.app then database folder.
Note:If you not inserted data,you can not see
I bought and installed SQLite Editor on to my tablet. It has a good search feature and found it. It was in:
/data/data/com.adobe.phonegap.app/app_database/http_192.168.1.117_3000/0000000000000001.db
The IP address is the local IP that phonegap server is running on.
I want to publish an Android application that I have developed but have a minor concern.
The application will load with a database file (or sqlite3 file). If updates arise in the future and these updates are only targeting the application's functionality without the database structure, I wish to allow users to keep their saved entries in their sqlite3 files.
So what is the best practice to send updates? Compile the apk files with the new updated code only and without the database files? Or is there any other suggestion?
PS: I am not working with Java and Eclipse, but with python for Android and the Kivy platform which is an amazing new way for developing Android applications.
if you're using local sqlite then you have to embed the database file within the app as failure to do so it means there's no database, in case for updates database have version numbers where as it can not upgrade the database provided the version number is the same as the previous app updates
I had the same issue when I started my app but since kivy has no solution for this I tried to create a directory outside my app directory in android with a simple os.mkdir('../##') and I put all the files there. Hope this helps!
Is there a way for an Android user to browse the SQLite databases on his/her phone and view the data in the databases?
I use the SoftTrace beta program a lot. It's great but has no way that I can find to download the data it tracks to a PC.
The database for a specific app lives in /data/data/[packagename]/databases
The packagename is the package you define in your manifest, for instance /data/data/org.vimtips.supacount/databases/counts.db.
You can view it with adb shell and type sqlite3 /data/data/org.vimtips.supacount/databases/counts.db
Or you can pull it from the device to look at it with a third party utility, with a command like adb pull /data/data/org.vimtips.supacount/databases/counts.db ..
This assumes you have permission to view the database, which you might not have if you didn't write the app yourself... but in that case, is it actually a programming question?
If you are using Eclipse, you can use a plugin called 'Questoid SQLite Browser' to browse the SQL Lite Database on your Android emulator:
Install the plugin
Restart eclipse
Start your emulator
Switch to DDMS
Open database with plugin (as #synic mentioned previously, the DB is located here e.g. /data/data/my_project/databases)
Here is a more detailed tutorial: http://www.tylerfrankenstein.com/browse-android-emulator-sqlite-database-eclipse
Here is the free method that worked for me on a phone that is not rooted. Credit goes to this SO answer.
Use adb backup -f backup.ab -noapk app.package.name
On Windows download the Android Backup Extractor jar found on SourceForge here, then run java -jar abe.jar unpack backup.ab extractedbackup.tar. On Linux you can follow the dd instructions from the answer I gave credit to in the beginning.
Download SQLite Database Browser from SourceForge here, then open the db file contained within extractedbackup.tar.
Personally, to make this process easier, I first added adb to my environment PATH. Then I made a backup folder where I store all of the files mentioned above. This keeps me from having to cd (change directory) all over the place.
The Questoid plugin appears to cost $9 and requires registering. Another alternative on Windows is to download the open-source public-domain SQLLite Browser (link below) and then pull the database from the phone. In Eclipse you can do this from the File Browser, going to the /data/data/[packagename]/databases directory on the phone or emulator, and clicking "Pull a File From The Device" in the top right. Save the database locally, then open with the SQLite Browser.
http://sourceforge.net/projects/sqlitedbrowser/
Actually the most available (yet still hacky) way of getting "live" results from a database while developing on emulator that I found is this:
Create a script to pull the database from emulator, something like this
#!/bin/bash
ANDROID_HOME=/path/to/sdk
ADB=$ANDROID_HOME/platform-tools/adb
REMOTE_DB_PATH=/data/data/com.yourpackage.name/databases/your_db
LOCAL_DB_PATH=.
while true; do
echo copying DB...
`$ADB pull $REMOTE_DB_PATH $LOCAL_DB_PATH`
sleep 3
done
Run it.
Install SQLite Manager plugin for Firefox
Open your local copy of the database (which is constantly overridden by the running script from step 1)
Enter your SQL:
Select File->Reconnect
Click Run SQL
The key trick is that reconnecting does not reset SQL entered on step 4 (as it does, for example, in SQLite Browser), so you can repeat steps 5,6 to see "live" results from your android database.
Note that this only works for emulator, it won't work for a real device (even a rooted one).
You can view you database from your app using this library . https://github.com/sanathp/DatabaseManager_For_Android
With this library you can manage your app SQLite database from you app itself.
you can view the tables in your app database , update ,delete, insert rows to your tables
Its a single java activity file ,just add the java file to your source folder.When the development is done remove the java file from your src folder thats it .
It helped me a lot .Hope it helps you too .
You can view the 1 minute demo here : http://youtu.be/P5vpaGoBlBY
If you were lucky enough to get IntelliJ Ultimate then you can plug the device in, open 'Database' tab on the right, click +, select SQLite. The rest is trivial.
One thing to keep in mind with it is that you have to keep clicking "Synchronize" button on the database (or on selected table) to see the changes made externally, which is very annoying.
See this answer. You can use Stetho library from Facebook and then just browser you database from Chrome :)