This article will tell you how to use android debug bridge to install or uninstall apps in android devices. You can read article How To Use Android Debug Bridge (ADB) to learn more if you do not know about android ADB.
1. Use ADB To Install Android Application.
1.1 Push app apk file to android device.
//Push to system app folder adb push example.apk /system/app. //Push to user app folder adb push example.apk /data/app.
This method has below disadvantages.
- Maybe overwrite original app, so you had better use below command to backup original app before operation.
// Pull android apk from device to local folder. adb pull /system/app/example.apk /user/app_bak
- Usually you can encounter below error messages.
failed to copy '/user/example.apk' to '/system/app/example.apk': Read-only file system.
This is bacause /system/app folder is read only, you can not push files into this folder.
To resolve this problem, you need use adb install command with -r option to force install the apk files, we will introduce it below.
// -r means force install. adb install -r /user/example.apk
Above command will install the apk into /data/local/tmp/ directory.
1.2 Use adb install command.
- Startup android emulator.
- Run adb install command as below to push android app into emulator /data/app directory.
adb install C:/work/example.apk
- Click the android app icon to run it in android emulator screen.
2. Use ADB To Uninstall Android Application.
2.1 Use ADB Uninstall Command.
You can find the android app package name use android device monitor. The package name is located in /data/data folder.
You can refer article Android Device Monitor Cannot Open Data Folder Resolve Method to how to use android device monitor.
adb uninstall <app package name>
2.2 Use ADB Shell Command.
adb shell cd /data/app rm com.dev2qa.example.apk
3. Uninstall Android App In Emulator.
You can also use android emulator to uninstall installed apps.
- Click Settings —> Apps.
- Click the android app that you want to uninstall in app list.
- Click uninstall button in app info panel.