TWRP recovery: "pm install /path/to.apk" not working I'm making a flashable zip for TWRP, to debloat my phone. I also want to install apps in the same script.

However, when I do "pm install /path/to.apk" (whether in a script or through the terminal) I get the following error:

Error: java.lang.NullPointerException: Attempt to invoke interface method 'android.os.IBinder android.os.IServericeManager.getService(java.lang.String)' on a null object reference


I get the same error when I try other pm commands, but when I input only "pm" I do get the help message.

Is it not possible to install .apks this way or is something else wrong?

Thanks!
Use script to place the APK file at the correct place in /data/app instead.

mkdir,mv,chown and chmod are to be used.

While pm binary is there, it cannot do it's work from recovery that is a completely different system.
See this as someone trying to install a game on his Windows system while booted on Ubuntu.