USB Debugging grants you a level of access to your device. This level of access is important when you need system-level clearance, such as when coding a new app. It also gives you much more freedom of control over your device. For example, with Android SDK, you gain direct access to your phone through your computer and that allows you to do things or run terminal commands with ADB.
These are the following steps in order to fix that problem:
- Become a developer: Settings >> About phone >> MIUI version tap 7 times.
- Again Settings >> Additional settings >> Developer options (turn on) >> USB debugging (turn on) >> Install via USB (turn on).
- You will be ask for permission through your MI account. Confirm it. (Not applicable to all devices).
- Note: During the installation of the application, your device will give you 7 seconds to confirm the installation. Don’t miss it!
For Latest Version of Xiaomi Phones:
Settings -> Additional Settings -> Developer options ->
- Turn off “MIUI optimization” and Restart.
- Turn On “USB Debugging“.
- Turn On “Install via USB“.
- Set USB Configuration to Charging.
- Turn On “install via USB“.
References:
https://stackoverflow.com/questions/47239251/install-failed-user-restricted-android-studio-using-redmi-4-device
https://stackoverflow.com/questions/37641670/adb-install-failure-install-canceled-by-user?answertab=votes#tab-top