If you are developing Android apps, using the Android Debug Bridge tool (ADB) may sometimes be necessary, or could save you a lot of time.
With ADB you can install/uninstall apps, forward ports, push/pull files to your device, remotely connect to SQLite databases on your device, record the device screen, and more. See the link at the bottom for a full reference.
Setting up the ADB tool
The ADB tool comes with the Android SDK, and you can find the adb tool in
Add the ADB tool to your shells path:
Or just add this line to your
.bashrc file (or
.zshrc if you are using zshell).
- Connect your device to your computer to run these commands.
- Also, you must enable USB debugging in the device system settings, under Developer options.
List connected devices
Installing an app
adb install appname.apk
And similarly for uninstalling:
adb uninstall com.package.name
Simulate App update
You can use this command to simulate an update of an existing app, if you want to test your upgrade scripts.
adb install -r appname.apk
Sideloading new versions of Android early
You can use adb to update your Android device with OTA updates you can download from the internet.
If you have a rooted device
If you have a rooted device you can do a bit more with the ADB tool, such as extracting app database files from the device:
- Open a terminal
adb shellto get a shell.
suto get root.
- Press 'Allow' on device
chmod 777 /data /data/data /data/data/com.application.pacakage /data/data/com.application.pacakage/*
- Go to the DDMS view in Android Studio (or just run the program independently from the SDK folder)
You should now be able to browse files on the device.
You can do a lot more with the ADB tool, refer to the Android developer documentation: http://developer.android.com/tools/help/adb.html