How to install an apk(app) with adb in Android

This article will introduce how to install an apk(app) or delete a package(app) with adb in Android.

1. "adb install APK_FILE"

The following command installs the YouTube.apk file located on the PC.

$ adb install YouTube.apk
Performing Streamed Install
Success

1.1 Install the apk file on the device.

The following command installs the apk file stored in the /data/local/tmp/YouTube.apk path of the device.

$ adb shell pm install /data/local/tmp/YouTube.apk
Success

Unfortunately, if you try to install the file "/sdcard/YouTube.apk" with this command, it will fail due to permission issues. Because adb couldn't get access to that directory like "/sdcard/", But, The path under "/data/local/tmp/" is possible, so, you should move it to "/data/local/tmp/" before installing if you want to install it.

$ adb shell pm install /sdcard/YouTube.apk
avc:  denied  { read } for  scontext=u:r:system_server:s0 tcontext=u:object_r:fuse:s0 tclass=file permissive=0
System server has no access to read file context u:object_r:fuse:s0 (from path /sdcard/YouTube.apk, context u:r:system_server:s0)
Error: Unable to open file: /sdcard/YouTube.apk
Consider using a file under /data/local/tmp/
Error: Can't open file: /sdcard/YouTube.apk

2. "adb uninstall PACKAGE_NAME"

The following command will uninstall the package com.google.android.youtube installed on the device.

$ adb uninstall com.google.android.youtube
Success

Related Posts

codechachaCopyright ©2019 codechacha