ionic 打包apk Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]

错误日志如下:

Built the following apk(s): 
        /Users/hongye0/Documents/project/haitoujiaApp/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Using apk: /Users/hongye0/Documents/project/haitoujiaApp/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Package name: io.ionic.starter
adb: Command failed with exit code 1 Error output:
adb: failed to install /Users/hongye0/Documents/project/haitoujiaApp/platforms/android/app/build/outputs/apk/debug/app-debug.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
[ERROR] An error occurred while running subprocess cordova.
        
        cordova run android exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.

解决办法如下

因为编译通过了,应该是手机问题,先关机重启发现没用,后来发现开发者模式下,需要打开 USB调试下面的“允许通过USB安装”。

注:我是MI6,需要登陆小米账号,必须查SMI卡,才能打开允许通过USB安装

原文地址:https://www.cnblogs.com/songhongye/p/10005609.html