Android – INSTALL_FAILED_USER_RESTRICTED : android studio using redmi 4 device

adbandroidandroid-studio

Android Studio with Failed Error

Got this freaky error

Installation failed with message Failed to finalize session : INSTALL_FAILED_USER_RESTRICTED: Install canceled by user.
It is possible that this issue is resolved by uninstalling an existing version of the `apk` if it is present, and then re-installing.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing application?

When trying to run the apk in my redmi 4 MIUI 8.5.4.0

OEM unlocking enabled

Solution Tried

  • MIUI optimization turned off
  • USB debugging turned on
  • Verify apps over USB turned on

NOTE: while turning on install via USB a pop up saying The device is temporarily restricted

Best Answer

Steps for MIUI 9 and Above:

Settings -> Additional Settings -> Developer options ->

  1. Turn off "MIUI optimization" and Restart

  2. Turn On "USB Debugging"

  3. Turn On "Install via USB"

  4. Set USB Configuration to Charging

  5. Turn On "install via USB

    MTP(Media Transfer Protocol) is the default mode.
    Works even in MTP in some cases