Thursday, September 19, 2013

How do you install an android application through terminal in a Mac system

Installing application

- Open terminal and change directory to platform tools folder 

- Type ./adb devices to check if device is connected.

1) Normal installation type
./adb install .apk (file location)

2) If there are more than 1 devices connected then type
./adb -s (device number) install .apk (file location)
Please note: You can see the device number from ./adb devices

3) If you are connected to emulator and you want to install the apk only to device then type
./adb install -d .apk (file location)
Please note if there are multiple devices connected then an error is displayed.

4) Re-install the application
./adb install -r .apk (file location)

5) Install in sd card instead of internal storage
./adb install -s .apk (file location)

Few other commands which are useful

1) To get log from your device
./adb logcat

2) Uninstall application
./adb uninstall (pacakage_name)

3) Uninstall application without removing data and cache
./adb uninstall -k (pacakage_name)

4) Start server to ensure its running
./adb start-server

5) Kill server if its running
./adb kill-server