1

I have a question about APK installation internals.

If you want to install an APK on some Android devices via ADB (adb install APK.apk or pm install /data/local/tmp/APK.apk) you have to enable USB installation in Developer Options. If the USB installation is not enabled, you'll be presented an error on installation, most likely something like

adb: failed to install app.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Installation blocked]

My questions are:

  • How is enabling/disabling of the USB installation implemented in the system? At what point does the error above occur?
  • Is there a way how to enable USB app installation via ADB? I know I could write a script that calls input tap X Y or similar GUI commands, but that's not what I want. What I'd like to know is whether there is an entirely non-GUI way of doing this, something like setprop install.via.usb 1 or echo 1 > /system/etc/install_via_usb

I'm interested in ways to do this for both rooted and unrooted devices.

Topper Harley
  • 375
  • 4
  • 17

0 Answers0