"adb -d install" Command Options

This section provides a tutorial example on how to use 'adb -d install' command options. '-r' is to reinstall an application without uninstall it. '-s' is to install an application on the SD Card instead of the internal memory.

To have a better control of the application installation process, I looked at the "adb" command document again. It gives the following command options:

adb install [-l] [-r] [-s] <file> - push this package file to the
   device and install it
   ('-l' means forward-lock the app)
   ('-r' means reinstall the app, keeping its data)
   ('-s' means install on SD card instead of internal storage)

adb uninstall [-k] <package> - remove this app package from the device
   ('-k' means keep the data and cache directories)

Now try some of those options:

1. Testing the reinstall option "-r":

C:\herong\HelloAndroid>\local\android-sdk-windows\platform-tools\adb
   -d install bin\HelloAndroid-debug.apk
812 KB/s (14980 bytes in 0.018s)
        pkg: /data/local/tmp/HelloAndroid-debug.apk
Success
^C

C:\herong\HelloAndroid>\local\android-sdk-windows\platform-tools\adb
   -d install bin\HelloAndroid-debug.apk
812 KB/s (14980 bytes in 0.018s)
        pkg: /data/local/tmp/HelloAndroid-debug.apk
Failure [INSTALL_FAILED_ALREADY_EXISTS]
^C

C:\herong\HelloAndroid>\local\android-sdk-windows\platform-tools\adb
   -d install -r bin\HelloAndroid-debug.apk
975 KB/s (14980 bytes in 0.015s)
        pkg: /data/local/tmp/HelloAndroid-debug.apk
Success
^C

2. Testing the SD Card installation option "-s":

C:\herong\HelloAndroid>\local\android-sdk-windows\platform-tools\adb
   -d install -r -s bin\HelloAndroid-debug.apk
504 KB/s (14980 bytes in 0.029s)
        pkg: /sdcard/tmp/HelloAndroid-debug.apk
Success
^C

Go to the phone. Tap on "Home", "Settings", "Applications", "Managing applications", then "On SD Card". You will "HelloAndroid" displayed in the application list.

You can try other command options yourself.

Table of Contents

 About This Book

 Installing JDK 1.8 on Windows System

 Installation of Android SDK R24 and Emulator

 Installing Apache Ant 1.9 on Windows System

 Developing First Android Application - HelloAndroid

 Android Application Package (APK) Files

 Android Debug Bridge (adb) Tool

 Android File Systems

 AboutAndroid - Application to Retrieve System Information

 android.app.Activity Class and Activity Lifecycle

 View Objects and Layout Resource Files

 Using "adb logcat" Command for Debugging

 Build Process and Package File Content

 Building Your Own Web Browser

 Android Command Line Shell

 Samsung Galaxy Tab 3 Mini Tablet

 USB Debugging Applications on Samsung Tablet

 Android Tablet - LG-V905R

 USB Debugging Applications on LG-V905R Tablet

 Android Phone - LG-P925g

USB Debugging Applications on LG-P925g Phone

 Installing LG USB Device Driver on Windows

 Viewing LG Android USB Device in Control Panel

 Turning on USB Debugging on LG-P925g

 Viewing USB Debugging Devices in Control Panel

 Running "adb" on LG-P925g USB Debugging Interface

 Installing Application to Phone using "ant installd" Command

 Installing Application to Phone using "adb -d install" Command

"adb -d install" Command Options

 Installing "AboutAndroid" to LG-P925g Phone

 Developing Applications with Android API Level 7

 Archived Tutorials

 References

 Full Version in PDF/EPUB