R.E.M. Web Development

Inspecting Your SQLite Database with adb

I use a Mac, so it may be slightly different if you use a different environment.

 

1. Find the location of the adb tool. In order to do this you need to know where your Android SDK is installed. If you use Eclipse you can find it by choosing 'Preferences' and when the window pops up click on 'Android' in the list on the left. In the main part of the popup window you should see a box labeled 'SDK Location'.

 

2. Start an emulator by launching one of your projects.

 

3. Open a command prompt and navigate to the location of the Android SDK. Inside that directory you should see a directory called 'platform-tools'. This is where you'll find adb. Note that in earlier versions of the SDK, adb was located in the 'tools' directory. Navigate into the 'platform-tools' dir and enter this command (this will start the adb shell):

 

./adb shell

 

4. Navigate to the /data/data/ directory:

 

cd /data/data/

 

 

5. You should see the package names of all applications that are installed in the emulator. Navigate into the one that has the SQLite database that you'd like to inspect, and then navigate into the 'databases' directory. You should see the database file in this directory.

 

6. To launch SQLite enter 'sqlite3 ' followed by the name of your database file, for example:

 

sqlite3 somedatabase.db

 

 

7. Now you can start entering SQLite commands. Here's a little cheat sheet if you are interested:

http://remwebdevelopment.com/blog/sql/sqlite-reminders-54.html

 

8. To quit SQLite, enter .exit at the command prompt.

 

9. To exit adb and return to your regular shell, press ctrl + d