- Start Running the Android Database Application.
In order to access the SQLite database from the command line shell, the application has to be active.
- Activate a Command Prompt.
Pick the following Windows options:
Start ⇒ All Programs ⇒ Accessories ⇒ Command Prompt
- Enter the Directory platform-tools.
For my computer, the directory is located at
C:\> cd C:\Android\SDK\platform-tools\
To find where your Android SDK is located, pick the following Android Studio options:
Tools ⇒ SDK Manager
The location can be found on the top of the screen.
- Start a Remote Shell.
Enter the command “adb shell
” where adb
is Android Debug Bridge, a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.
- Enter the Database.
Enter the command:
# sqlite3 /data/data/yourpackage/databases/yourdbname
For my computer, the command is as follows:
# sqlite3 /data/data/com.example.wenchen.sqlitedemo/databases/applicationdata;
where
yourpackage
:
My package is named com.example.wenchen.sqlitedemo
and
yourdbname
:
My database is named applicationdata
.
†If you encounter a problem of
Error: unable to open database "applicationdata": unable to open database file
check the Stackoverflow to solve it by adding two commands:
shell> adb root
shell> adb root restarting adbd as root
shell> adb shell
- Start Managing the Database.
Check the Command Line Shell for SQLite.
- Exit the Database and adb.
Enter the commands:
sqlite> .exit
.exit
# exit
exit
C:\Android\SDK\platform-tools>