这是一个可怕的错误

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?

当试图在我的红米4 MIUI 8.5.4.0中运行apk时

启用OEM解锁

解决方案尝试

MIUI优化关闭 打开USB调试 通过打开USB验证应用程序

注意:当通过USB打开安装时,会弹出提示“设备暂时受限”


当前回答

更新MIUI 12:

我必须在其他设置旁边打开“OEM解锁”。 (我不需要改变“小米解锁状态”

其他回答

MIUI 9及以上的操作步骤:

设置->附加设置->开发人员选项->

关闭“MIUI优化”并重新启动 打开“USB调试” 打开“通过USB安装” MTP(Media Transfer Protocol)为默认模式。 在某些情况下甚至可以在MTP中工作 “USB配置”设置为“充电”

在开发人员选项中禁用模拟SD卡优化 关闭“开启MIUI优化” 标记强制关闭的应用程序

这些设置对我有用。

从开发人员选项中关闭MIUI优化 安装app 把它打开。

下次安装这个apk(和它的更新)不会再给出这个错误。

If above answer didn't work for you as it didn't work for me on my Xiaomi Mi5.I tried to figure out the Core reason behind it and solve it. In MIUI, in order to change "Install via USB" option, you must be connected to the internet and signed in your Mi account. Due to some reason, requests from out of the China servers are getting rejected, so I connected to one open China VPN and tried again to enable 'Install via USB' and I got success. For detailed solution and VPN details, see this useful Youtube video: https://youtu.be/MeKUJlD-Ke4

与小米红米 Note 8 pro (MIUI 10.4.4), 安卓 9 -

当从Windows PC(通过USB线)连接到Vysor(2.1.2)时,收到错误消息:

"安装APK出错:失败[INSTALL_FAILED_USER_RESTRICTED]"

即使打开了“USB调试”。

因此需要以下设置-

开发人员选项(开启) USB调试(开) 通过USB安装(开启)

留下以下内容,

开启MIUI优化(开启) 通过USB验证应用程序(开启)