view raw
dg_no_9 dg_no_9 - 11 months ago 56
Bash Question

Android: How to Know if any application is already installed in android device using adb?

I've to install an android app with package name like "" using adb.
I want to automate the process using shell script. The process will be like if app is already installed, uninstall it(with command adb uninstall and install using "adb install game.apk" otherwise simple "adb install game.apk".

How can I achieve this?



According to (also) correct answer below, try grep the result from pm list packages.

adb shell pm list packages | grep


If the application is already installed and if you try to install the same app again, adb will return with an error - Failure [INSTALL_FAILED_ALREADY_EXISTS]. However, if you want to re-install the already installed app, then use -r parameter.


adb install -r game.apk