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

[Update 2]

Without using grep

adb shell pm list packages [your.package.name] as mentioned in the below answer

[Update]

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

adb shell pm list packages | grep com.your.app.package


[Original]

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.

Ex:

adb install -r game.apk

Try grep the result from pm list packages.

adb shell pm list packages | grep com.xyz.game

You may see the result if already installed.

package:com.xyz.game

No need to use grep. Using following commands you can simply check if application is already exist or not.

Run ADB command

adb shell pm list packages [your.package.name]

If app is already installed then above command will return,

package:[your.package.name]

Else it won't return anything i.e. empty String.

Tags:

Shell

Android

Adb