Android FAQ: How do I start the Android command line tool (so I can interact with my Android emulator or device)?
You start the Android command line with the adb shell
command:
$ adb shell
This makes at least two assumptions:
- You have the Android SDK installed.
- You have an Android emulator (or physical device) running.
When you start the adb
shell, you'll see a very simple prompt that looks like this:
#
At the adb shell prompt you can enter a variety of commands to interact with your Android emulator or device.
Android adb commands
You can find a complete list of adb commands here on the Android developer website. Here's a brief list of frequently used commands:
adb devices list the installed devices adb pull <remote> <local> copy a file or directory from the emulator or device adb push <remote> <local> copy a file or directory to the emulator or device adb install Foo.apk install the APK file/app adb install -r Foo.apk update the already installed app adb uninstall <pkg> uninstall the app given by pkg ls list files and directories logcat view the system's log buffers start-server kill-server kill the server (if it's running) reboot reboot the device
This command lets you uninstall an Android application, where the argument given to the uninstall command is the root package name of the app:
$ adb uninstall com.devdaily.fptracker
(Here’s a little more information about using the Android adb uninstall command.)
Finally, use this adb
command to start SQLite, giving it the name of your database:
# sqlite3 data/data/com.devdaily.myapp/databases/MyDatabase.db
There are many more adb commands you can use. Check your current adb
command with adb -help
to see more information on all of these commands, and more. (Here’s a link to the Android adb page.)