这是一个可怕的错误

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打开安装时,会弹出提示“设备暂时受限”


当前回答

更多详细视频

1) Turn ON Developer Options
2) Turn ON USB Debugging
3) Turn OFF MIUI optimization
4) Turn ON Install via USB

YouTube视频,以获得更直观的理解

其他回答

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

MIUI 9及以上的操作步骤:

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

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

要打开“通过USB安装”和“USB调试(安全更改)”,需要登录到小米帐户,然后这两个可以打开,并与红米作为开发人员一起工作

注意:当打开USB调试(安全更改)时,会弹出一些安全警报,所有安全警报都需要接受才能在开发人员模式下工作

参考

同样的设备也出了同样的问题。

所以,这是小米的麻烦,下面是这个问题的解决方案:

进入“安全”应用程序,点击右上角的“选项” 角落里 向下滚动到“功能设置”组,寻找“权限” 在那里关闭“通过USB安装”选项,该选项管理 不允许通过USB安装应用程序。

最新版本红米设备:

>附加设置>开发人员选项>开发人员选项:检查“通过USB安装”选项。

在我的情况下,我不幸地在第一次安装时按下了拒绝。我得到INSTALL_FAILED_USER_RESTRICTED。

您可以在权限下修改应用程序的此权限。

设置->权限->通过USB安装->{您的应用程序}

您也应该启用以下选项。

设置—>附加设置—>隐私—>未知来源

>附加设置->开发人员选项->通过USB安装