yashsingh1/xdaforums huggingface dataset:
[Android Q&A, Help & Troubleshooting] Vordx:
Articles like https://www.xda-developers.com/uninstall-carrier-oem-bloatware-without-root-access/
[Android Q&A, Help & Troubleshooting] JaviLerma:
Hi, doesn't works

/system/bin/sh: cmd: not found
[Android Q&A, Help & Troubleshooting] alexander_sirakov:
It does work. Thank you!
[Android Q&A, Help & Troubleshooting] jazzh:
Hi! Does this work on huawei p smart 2019 with android pie? Will ota work after that?
[Android Q&A, Help & Troubleshooting] Vordx:
Has nothing to do with OTA. That code only installs apk.

I need a screenshot or I can't be sure what you did wrong.
[Android Q&A, Help & Troubleshooting] jazzh:
Gr8.
[Android Q&A, Help & Troubleshooting] jazzh:
I successfully applied this in p smart 2019.
[Android Q&A, Help & Troubleshooting] barjani:
Not work

it doesn't work :(
[Android Q&A, Help & Troubleshooting] jazzh:
You typed install, not uninstall :)
[Android Q&A, Help & Troubleshooting] barjani:
i just copy paste command from the text above except the packages that i want to install again

"you can simply use "adb shell cmd package install-existing <package name>" in ADB and you'll get the package back ."

is it this thread to install back again packages or to uninstall packages?

i want to install back my packages, which I using command "adb shell pm uninstall -k --user 0 <name of package>" to uninstall it.
[Android Q&A, Help & Troubleshooting] jazzh:
Try to find that apk and put in the folder of the command prompt call from pc.
[Android Q&A, Help & Troubleshooting] jcmm11:
What version of Android are you running? What's the output of "ls -l /system/bin/cmd"?
[Android Q&A, Help & Troubleshooting] barjani:
android ver. 5.1.1 and android ver 7.1.2

on ver. 5.1.1 got "No such file or directory" but on ver 7.1.2 got "-rwxr-xr-x 1 root shell 21964 2019-03-07 12:23 /system/bin/cmd"

i want to re-install app on android ver 5.1.1.

is it posible to install back on 5.x.x? after seing output from 'ls' command on terminal
[Android Q&A, Help & Troubleshooting] Vordx:
You sure it's uninstalled using ADB and not root ?
[Android Q&A, Help & Troubleshooting] barjani:
Yups ... it's uninstalled with ADB command, i just follow from this article https://www.xda-developers.com/uninstall-carrier-oem-bloatware-without-root-access/ to unistall and no root access.
[Android Q&A, Help & Troubleshooting] djinn_tyagi:
Im also having similar problem, uninstalled through adb, but when i try to reinstall it, it gives error

/system/bin/sh: CMD: not found
[Android Q&A, Help & Troubleshooting] flohwie:
It works for me (windows cmd prompt), should be the same in linux terminal:

type

1) adb shell

and within the shell type:

2) cmd package install-existing <name of package>

alternatively type directly from command prompt:

adb shell cmd package install-existing <name of package>
[Android Q&A, Help & Troubleshooting] emkorial:
Tried running this on Android 6 on my moto G4, install-existing is NOT a listed argument for pm, and now my phone is dead since I can't reinstall a removed app. Wonderful.

the OP should update thier post that this is ONLY for Android versions 7 and higher. It will not work on android 6 or lower.
[Android Q&A, Help & Troubleshooting] GameTheory.:
For you guys getting this error:

"/system/bin/sh: cmd: not found"

Not all android versions have the "cmd" utility in "/system/bin".
[Android Q&A, Help & Troubleshooting] Airship17:
>> Not all android versions have the "cmd" utility in "/system/bin".

Do you mean cmd is nowhere on the phone or it is not in "/system/bin" but is somewhere else?

If it's not in "/system/bin" can it be copied into the phone in some other location and run there with more extensive path information?

I've no idea if the above are stupid questions in the Android context but in e.g. dos you could stick the program anywhere provided it was self contained and you fed it appropriate path info. Can you copy cmd into some writable location on the phone and run it, or would it lack sufficient permissions?
[Android Q&A, Help & Troubleshooting] jcmm11:
It's not on the phone. Apparently cmd was introduced with Android 7. Since those older versions of Android all would allow you to remount /system as rw (assuming you're rooted or doing it via TWRP) you could try copying cmd into /system/bin and see if it would work, but don't be surprised if it doesn't since the components it's interacting with may well be missing the necessary hooks. Only way to know for sure is to try.

Better option would be to upgrade.
[Android Q&A, Help & Troubleshooting] russerb:
Thanks bro allot, you helped allot, I had the same problem like Malang, but I guess he didn't read the beginning of your quote carefully enough, command : adb shell cmd package install-existing packagename (example: com.android.phone) does work on any android device without root, it has nothing to do with the type of android system or the device, it is command to restore uninstalled apk for certain user done through ADB, I just did it on latest huawei android and saved myself of resetting the device again - thanks allot !!
[Android Q&A, Help & Troubleshooting] fernoct:
Lifesaving, time saving thread. Many thanks OP!
[Android Q&A, Help & Troubleshooting] Dexter_S:
Hello, when I type in the command, I get an error "Unknown command: install-existing"
[Android Q&A, Help & Troubleshooting] M4XXX:
Thanks Bro! This saved me a lot of time
[Android Q&A, Help & Troubleshooting] Vordx:
What phone are you both using?
[Android Q&A, Help & Troubleshooting] Dexter_S:
I am using a Redmi 4 (Santoni)
[Android Q&A, Help & Troubleshooting] master_lam:
OMG! You saved me. Thank for install-existing command. :D
[Android Q&A, Help & Troubleshooting] Danizer:
for those getting

/system/bin/sh: adb: not found error,

use this

cmd package install-existing <package name>

instead of

adb shell cmd package install-existing <package name>
[Android Q&A, Help & Troubleshooting] Mr6P:
OMG, thank you so much.

I tried some stuff and uninstalled One UI Home (launcher) and thought I have to factory reset :crying:

Used this and worked perfectly fine:

.\adb shell cmd package install-existing com.sec.android.app.launcher
[Android Q&A, Help & Troubleshooting] Vordx:
Unfortunately it might not work on 7.0 and below, not tested much but few devices that run 7.0 and marshmallow 6.0 failed to execute the command.
[Android Q&A, Help & Troubleshooting] shashank405:
if anyone came here for accidentally uninstalling calendar packages on miui, just install latest miui calendar storage apk directly from your phone. no need to hard reset or anything. this worked for me

https://www.apkmirror.com/apk/xiaom...lendar-storage-10-0-5-0-android-apk-download/
[Android Q&A, Help & Troubleshooting] thesebastian:
How can I know which packages I deleted?

I'd like to restore all the ones i removed.

I can't find any I recognize with:
[Android Q&A, Help & Troubleshooting] trulyfurqan:
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.
[Android Q&A, Help & Troubleshooting] blackwood1:
can somebody help identify the package to get my gps working again, I've tried com.google.android.location

huawei jkm-lx1 emui9.1
[Android Q&A, Help & Troubleshooting] barjani:
You can install "App Inspector" from playstore to get app package name
[Android Q&A, Help & Troubleshooting] loopypalm:
let's say the phone is not ON

will this command be valid in twrp or fastboot mode ?
[Android Q&A, Help & Troubleshooting] lolan11628:
Thank you!

I can confirm it works on my Huawei P40 Pro: https://xdaforums.com/huawei-p40-pro/help/huawei-built-photo-gallery-t4145105
[Android Q&A, Help & Troubleshooting] xSil3nt:
This may not work for everyone, on all devices. & it also depends on how you removed the application, if you had, for example, deleted the application folder from system/app/ or system/priv-app/, this may not work, you could try extracting the app you deleted from the stock firmware file and copying over the app to the proper folder in TWRP if you had done something like this.
[Android Q&A, Help & Troubleshooting] DragonReaper02003:
For guys with errors

Do not put < and > symbol before and after package name
[Android Q&A, Help & Troubleshooting] Vordx:
If you have root to do this, i don't know why would someone even use this non root adb command, root methods achieve better results.
[Android Q&A, Help & Troubleshooting] :
So-called bloatware is typically installed in Android's /system partition, hence Android must got rooted and the /system partition must got mounted as readwriteable in order to remove the bloatware.
[Android Q&A, Help & Troubleshooting] Swastick:
what will all people do who are facing cmd: command not found error ?

.\adb shell cmd package install-existing com.sec.android.easyonehand

I have tried this one also and without .\ same error please help me.

Thanks in advance
[Android Q&A, Help & Troubleshooting] HemanthJabalpuri:
https://xdaforums.com/android/help/how-to-install-uninstalled-packages-t3894235/post82569997

.

@Vordx

In https://selivan.github.io/2020/02/25/removing-bloatware-from-xiaomi-miui-android.html he used different commands for re-installing uninstalled apps...

Any opinion on this?

# Install uninstalled system app
pm install --user 0 $(pm dump app.package.name | awk '/path/{ print $2 }')
# Another way to install uninstalled system app
pm install-existing app.package.name

Edit:-

From 5.0 and higher, it seems like there is not apk path is pm dump.

For this try pm dump <package_name> | grep -i path.

After this we can see /system directory paths. Then run ls <system_dir_path>. We can get apk name from this.

Finally pm install <system_dir_path>/<apk_name>.

Thanks
[Android Q&A, Help & Troubleshooting] mudassir331:
love u bro

I just made my account to tell you thank you so much

---------- Post added at 10:22 AM ---------- Previous post was at 10:18 AM ----------

i just make this account to say thank you so much
[Android Q&A, Help & Troubleshooting] Razege:
I have spent too many hours trying to get this to work.

I foolishly uninstalled the "Line" app from my phone, thinking that I could reinstall it with a better version, only to find out that it is hardwired into the phone itself.

I succeeded to update it, but it still says "Not Installed for This User".

And when trying to run the install-existing command, it says "/systerm/bin/sh: cmd: not found"

I am running Android 5.1.1 on a fresh "Aquos Keitai 2". Is the only hope for me to factory reset?
[Android Q&A, Help & Troubleshooting] :
Android isn't designed for command-line use, so it doesn't come with the full set of command-line programs that a GNU-Linux system would have.

See also here: Android Lollipop toolbox command reference

BTW: Even Toybox implemented since Android Marshmallow doesn't know of this command.
[Android Q&A, Help & Troubleshooting] Razege:
Thank you for replying so quickly, btw~!

Okay, so then... what do I do? Is there anything that I can do... before I accept the fate of having to factory reset the phone?
[Android Q&A, Help & Troubleshooting] HemanthJabalpuri:
Did you tried the commands of my above post https://xdaforums.com/android/help/how-to-install-uninstalled-packages-t3894235/post83676619
[Android Q&A, Help & Troubleshooting] :
isn't a valid command: Look inside here.

That's also true for

And

is a command neither recognized by Toolbox nor by Toybox
[Android Q&A, Help & Troubleshooting] HemanthJabalpuri:
[MENTION=1890170]jwoegerbauer[/MENTION]

# Install uninstalled system app
pm install --user 0 $(pm dump app.package.name | awk '/path/{ print $2 }')

will work I think since pm dump is there https://android.googlesource.com/pl...1/cmds/pm/src/com/android/commands/pm/Pm.java and awk can be used from Termux or from busybox.

It seems like all of them I have given are available from Pie(9.0) only!

pm seems like wrapper from 9.0 https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-9.0.0_r1/cmds/pm/pm

and also awk is included in 9.0 https://android.googlesource.com/platform/system/core/+/master/shell_and_utilities/README.md
[Android Q&A, Help & Troubleshooting] Razege:
Which one? This one? :

pm install --user 0 $(pm dump app.package.name | awk '/path/{ print $2 }') ???
[Android Q&A, Help & Troubleshooting] HemanthJabalpuri:
yes.

I think it will simply fail with awk command not found since you have Lollipop and no busybox in $PATH.

Use below one

pm install --user 0 "$(pm dump package_name | grep path | dd bs=1 skip=10)"

Another way to use initial command that uses awk is, install https://play.google.com/store/apps/details?id=ru.meefik.busybox and open and close app. In adb shell use

export PATH=/data/data/ru.meefik.busybox/files/bin:$PATH

and then use the intial command with awk any number of times in that shell.
[Android Q&A, Help & Troubleshooting] Razege:
What does "pm dump package_name" do?

Also, what are these:

"grep path"?

"dd"?

"bs=1"?

"skip=10"?​
[Android Q&A, Help & Troubleshooting] HemanthJabalpuri:
pm install --user 0 "$(pm dump package_name | grep path | dd bs=1 skip=10)"

will install the uninstalled package in older devices.

pm dump will get all info about app corresponding to pkg.

grep path will only select the path info in all info.

dd bs=1 skip=10 will only take the apk path in info.

finally we can get apk path with these three commands.
[Android Q&A, Help & Troubleshooting] Razege:
Well, I didn't get any code. All I received is

"Failure [INSTALL_FAILED_INVALID_APK]"

my code I put in, after the "adb shell" command, was this:

pm install --user 0 "$(pm dump jp.naver.line.android | grep path | dd bs=1 skip=10)"
[Android Q&A, Help & Troubleshooting] HemanthJabalpuri:
Try this

pm install --user 0 "$(pm dump package_name | grep codePath | dd bs=1 skip=15)"
[Android Q&A, Help & Troubleshooting] Razege:
Alas, it also did not work. Here's a screenshot of the code process:
[Android Q&A, Help & Troubleshooting] Bound2Last:
Tried the same to install and have the same error, unknown command pm

---------- Post added at 04:30 AM ---------- Previous post was at 04:25 AM ----------

Tried all of these commands nothing doing, just showing command unknown.

But thanks for helping.

I guess a full factory wipe is my only option.

Using Kyocera Cadence 4g device, a flip phone.
[Android Q&A, Help & Troubleshooting] mahmood monasser:
It’s work
[Android Q&A, Help & Troubleshooting] BarbaTrucMuche:
Hi! I succesfully uninstalled some bloatware on my Huawei P30 pro (EMUI 10.1.0.175) using:

adb shell pm uninstall -k --user 0 <package-name>

Unfortunately, I removed a package I shouldn't by mistake (com.android.storagemanager). I tried to reinstall it using:

adb shell cmd package install-existing <package-name>

But it fails, saying the package doesn't exist... I tried on another package I'd removed, and it works. Any idea how to get com.android.storagemanager back on my phone? Would this apk be an option? https://www.apkmirror.com/apk/xiaomi-inc/storage-manager-4/storage-manager-4-10-release/ Fortunately, no bugs yet, but still, I would like to have it back. Thanks!
[Android Q&A, Help & Troubleshooting] :
Do a factory reset.
[Android Q&A, Help & Troubleshooting] BarbaTrucMuche:
Thanks, I know this is an option, but I prefer to avoid spending hours on reconfiguring my phone if I can, especially since there's no bug yet from having com.android.storagemanager uninstalled.
[Android Q&A, Help & Troubleshooting] Kgonla:
Hello, I have frozen several system packages with Lucky Patcher & now no apps opens.

I am trying to recover them with ADB, this is what I do:

adb shell cmd package install-existing <name of package>

I get:

Package <name of package> installed for user: 0

But when I run

adb shell pm list packages -d

packages are still on the list, they are not restored.

Any help? Thank you.
[Android Q&A, Help & Troubleshooting] Mac23:
You can reinstall an uninstalled app like this (no need for factory reset):

get the path for that app (that's the same awk does, in my case I want FM-Radio back):

pm dump com.android.fmradio | grep path

install the app:

pm install -r --user 0 /system/priv-app/FMRadio/FMRadio.apk

"cmd package install-existing com.android.fmradio" did not work on my LOS 14.1, because the parameter "install-existing" seems not to be implemented.
[Android Q&A, Help & Troubleshooting] joker.lg:
big brain ! i was looking this way since i accidentally disabled an app. this helped android 10 thank you !
[Android Q&A, Help & Troubleshooting] jarenquegan:
That's because you've entered the wrong command. If you're using command prompt then you don't have to type adb shell anymore. You just have to type cmd package install-existing <package name> then hit enter.

Ps. You don't have to type adb shell anymore coz you have already entered the command at the very beginning.
[Android Q&A, Help & Troubleshooting] k500zm:
@Vordx

Mate you just saved my bacon - I uninstalled system launcher com.miui.home from my mi 10 lite 5g and it screwed the recent items.

Thought I would have to factory reset or wait until a new system update to repair it - but your fix worked like a charm!

Thank you SO much ;)
[Android Q&A, Help & Troubleshooting] Hitti2:
I actidently uninstall "adb shell pm uninstall -k --user 0 com.android.shell"

I copied the wrong one overlooking. I no longer have shell on my phone.

Andoid 11, oneUI 3.1

can anyone help?

Edit:

I have the shell.apk package, I pulled from another s10+ same phone and same OS version.

I install the apk by MIX Explorer to package installer. But it says app not installed.
[Android Q&A, Help & Troubleshooting] Vordx:
Sorry for the late reply, did you fix it yet? There was another command shared here.
[Android Q&A, Help & Troubleshooting] billa:
Try re-enabling using these methods.

adb shell cmd package install-existing com.android.shell

OR

Find the shell APK file and path via:

pm dump com.android.shell | grep path

then reinstall it via

pm install -r --user 0 <full_path_and_file.apk>
[Android Q&A, Help & Troubleshooting] beyenpe:
I disable the themes app but then needed to enable it back but now there's a "themes" icon on my home screen which was not there before. is there any way to get rid of it?
[Android Q&A, Help & Troubleshooting] Термик:
Failure [INSTALL_FAILED_INVALID_APK: Package com.android.systemui is a persistent app. Persistent apps are not updateable.]

What should I do? I removed SystemUI and I need to restore it asap!
[Android Q&A, Help & Troubleshooting] yosia_ryan:
SayaIt works but you must have su / magisk root access
[Android Q&A, Help & Troubleshooting] bennie!:
Hi Guys

I ran into a problem on my tablet after removing a lot of apps my dialler does not work anymore. I think the app I should not have removed is:- com.android.server.telecom. I tried various methods of reinstalling it but failed.

See my errors below:

-------------------------------------------------------------------------------------------------------------------------------

C:\>adb shell

HWAGS-Q:/ $ cmd package install-existing com.android.server.telecom

cmd package install-existing com.android.server.telecom

Unknown command: install-existing

HWAGS-Q:/ $ cmd package install com.android.server.telecom

cmd package install com.android.server.telecom

Error: must specify a APK size

HWAGS-Q:/ $ pm dump com.android.server.telecom | grep path

pm dump com.android.server.telecom | grep path

path: /system/priv-app/Telecom/Telecom.apk

HWAGS-Q:/ $ pm install -r --user 0 /system/priv-app/Telecom/Telecom.apk

pm install -r --user 0 /system/priv-app/Telecom/Telecom.apk

Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl229573452.tmp/base.apk: /data/app/vmdl229573452.tmp/base.apk: File res/drawable-xxxhdpi-v4/ic_message_24dp.png in manifest does not exist]

1|HWAGS-Q:/ $

-------------------------------------------------------------------------------------------------------------------------------

Any advice would be greatly appreciated.
[Android Q&A, Help & Troubleshooting] noble-4:
thanks, it worked for me.

I restored the gallery app from my huawei phone -that i previously have deleted-

adb shell cmd package install-existing com.android.gallery3d

(the app just restored for itself, i didn't pass any apk path parameter)

I use this code to delete some apps

1st list devices (optional)

adb devices

2nd - search for apps that want to delete (optional)

adb shell pm list packages | findstr 'huawei'

3rd - delete

adb shell pm uninstall -k --user 0 com.android.gallery3d
[Android Q&A, Help & Troubleshooting] ThatMG393:
Hi, 'install-existing' is not available in my Samsung with version Android 8
[Android Q&A, Help & Troubleshooting] Pra7ul:
Thanks Man, it works for Android 13, uninstalled com.google.android.gms by mistake, got it back. 💕
[Android Q&A, Help & Troubleshooting] Shouri69:
after uninstalling, i found myself unble to retrieve MiGallery in various ways. This didn't work too. Look :

$ pm install -r --user 0 /system/priv-app/MiuiGallery/MiuiGallery.apk

Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]

But i did ****in not do anything.

And on 2nd try, it shown me this :

/system/bin/sh: <stdin>[2]: $: not found

(All operations happened in a non rooted phone by bugjäeger App)
[Android Q&A, Help & Troubleshooting] Orsocamillo:
i need some help please,

i was tired of samsung keyboard and, since my s9 samsung is rooted i deleted the app by using "system app remover" found on playstore.

After rebooting the phone is stuck in bootloop, i can boot into twrp and i tried to reinstall the apk i just downloaded into my sd card without success. Adb devices, under linux mint, recognizes the phone in recovery. Any help will be appreciated
[Android Q&A, Help & Troubleshooting] masterminds71:
shellprompt:/ $ pm install-existing com.android.providers.contacts

Package com.android.providers.contacts installed for user: 0