Friday, November 11, 2011

Uninstalling Android app from command line

If you are switching between PROD and DEV versions of your app you will get this error:


[2011-11-26 14:27:22 - Local Guide Chicago] Re-installation failed due to different application signatures.
[2011-11-26 14:27:22 - Local Guide Chicago] You must perform a full uninstall of the application. WARNING: This will remove the application data!
[2011-11-26 14:27:22 - Local Guide Chicago] Please execute 'adb uninstall com.chicagoandroid.chicagolocal' in a shell.
[2011-11-26 14:27:22 - Local Guide Chicago] Launch canceled!



Make sure you have ONLY ONE device connected to USB, or the command will fail.
It would be also a good idea to put adb on your classpath, but it is not essential.

Open Terminal and perform these two commands (adjust to your situation):


$ cd /Applications/Android/android-sdk-macosx/platform-tools
$ ./adb uninstall com.chicagoandroid.chicagolocal
Success

one line version would be:

$ /Applications/Android/android-sdk-macosx/platform-tools/adb uninstall com.chicagoandroid.chicagolocal
Success



Since I do that often I made this automatic:

1. Open TextEdit
2. past the command:
/Applications/Android/android-sdk-macosx/platform-tools/adb uninstall com.chicagoandroid.chicagolocal
3. save with .bash extension
4. change permission to execute:
$ chmod 755 /Users/uki/Desktop/Uninstall\ Chicago\ Local\ Guide.bash
5. Make sure that Terminal knows to open .bash files