Can't reinstall an app uninstalled through ADB I recently got a Huawei P30 and used adb to remove some preinstalled apps I didn't want to use. I went a bit too far and removed the system gallery app (com.android.gallery3d) which turns out to be problematic for multiple things, such as opening taken pictures directly from the camera app.

I've tried reinstalling it but I'm facing multiple issues:


When trying to install the APK that's still on the phone in /system/priv-app/Gallery2, I get a INSTALL_PARSE_FAILED_NO_CERTIFICATES error. The full error:


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



When trying to install a version I found online, I get a INSTALL_FAILED_VERSION_DOWNGRADE, which is odd as the app is supposed to be uninstalled. It doesn't appear in pm list packages, however running dumpsys package com.android.gallery3d does give a result, and the version is indeed more recent than the one I'm trying to install (9.1.1.309 vs 9.0.15.355). Using the -d flag when installing doesn't help as it's not a debug app. I couldn't find a more recent version online.


Is there a way to reinstall this app that doesn't involve a factory reset? Alternatively, is there a way to install a different version of it? It seems like com.android.gallery3d is a generic package name, I wouldn't be against having the "stock" Android one.
The solution can be found in the question Reinstall System app which is uninstalled for the current user? (which is unanswered):

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


Note this doesn't work in Android 5 (hence the other question), as the cmd command was only added later (I don't remember exactly when, but it's available in Android 7 at least).