Android Adb安装失败:安装被用户取消

Android Adb安装失败:安装被用户取消,android,adb,ionic2,Android,Adb,Ionic2,我试图通过adb安装应用程序,但出现错误: $ ./adb -d install /Users/dimon/Projects/one-place/myprogram/platforms/android/build/outputs/apk/android-debug.apk -r -g 3704 KB/s (4595985 bytes in 1.211s) pkg: /data/local/tmp/android-debug.apk Failure [INSTALL_CANCELED_BY

我试图通过adb安装应用程序,但出现错误:

$ ./adb -d install /Users/dimon/Projects/one-place/myprogram/platforms/android/build/outputs/apk/android-debug.apk -r -g
3704 KB/s (4595985 bytes in 1.211s)
    pkg: /data/local/tmp/android-debug.apk
Failure [INSTALL_CANCELED_BY_USER]
在这个时刻,我什么也不做。 设备是小米MI5,MIUI7.2.13,安卓6.0。已启用开发人员模式。 如何解决这个问题

我在尝试运行“ionic run android”命令时遇到的错误与此相同

UPD

以下是“adb logcat”命令在安装程序中的日志:

06-06 10:04:20.051   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.063   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.078 13397 13397 E ANDR-PERF-MPCTL: Unable to create control service (stage=2, rc=-1)
06-06 10:04:20.082   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.079 13396 13396 W iop     : type=1400 audit(0.0:527): avc: denied { write } for name="socket" dev="tmpfs" ino=14686 scontext=u:r:dumpstate:s0 tcontext=u:object_r:socket_device:s0 tclass=dir permissive=0
06-06 10:04:20.088   788   903 I DisplayFeatureService: void android::update_watchlist(const prop_info*, void*): sys.boot_completed: 1
06-06 10:04:20.926 13400 13400 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
06-06 10:04:20.930 13400 13400 D AndroidRuntime: CheckJNI is OFF
06-06 10:04:20.966 13400 13400 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
06-06 10:04:20.995 13400 13400 I Radio-JNI: register_android_hardware_Radio DONE
06-06 10:04:21.004 13400 13400 E         : WFDWhiteListing : library initialized successfully
06-06 10:04:21.020 13400 13400 D AndroidRuntime: Calling main entry com.android.commands.pm.Pm
06-06 10:04:21.027 13400 13400 I Timeline: Timeline: Activity_launch_request time:973226
06-06 10:04:21.028  1497  2996 I ActivityManager: START u0 {act=android.intent.action.VIEW dat=file:///data/local/tmp/android-debug.apk typ=application/vnd.android.package-archive flg=0x18000000 cmp=com.miui.securitycenter/com.miui.permcenter.install.AdbInstallActivity (has extras)} from uid 2000 on display 0
06-06 10:04:21.033  1497  2996 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.033  1497  2996 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.033  1497  2996 E         : Service not available yet
06-06 10:04:21.034  1497  2996 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.037  1497  2996 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.037  1497  2996 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.037  1497  2996 E         : Service not available yet
06-06 10:04:21.037  1497  2996 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.050  2875  3077 D PowerKeeperEventLogManager: notifyForegroundCompomentChanged ComponentInfo{com.miui.securitycenter/com.miui.permcenter.install.AdbInstallActivity}
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: notify state normal_state enter...
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: foreground_change:
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: set_cpu_powermode(middle)
06-06 10:04:21.051  2875  3036 I PowerKeeperExecutor: no local quick execution method for set_cpu_powermode
06-06 10:04:21.051  2875  3036 D PowerKeeperExecutor: set_lcd_mode(ui)
06-06 10:04:21.051  2875  3036 I PowerKeeperExecutor: no local quick execution method for set_lcd_mode
06-06 10:04:21.049  2887  2887 W EventReader: type=1400 audit(0.0:528): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.049  2887  2887 W EventReader: type=1400 audit(0.0:529): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.051  3247  4440 I octvm_power: power mode [normal] start 1465200261
06-06 10:04:21.051  3247  4440 I octvm_power: Action: set_cpu_powermode(middle) for [foreground_change]
06-06 10:04:21.051  3247  4440 I octvm_drv: common drv: platform_set_power_profile -> platform not support
06-06 10:04:21.051  2533  2887 I octvm   : task pid 2113 have been add to group sys_standby.
06-06 10:04:21.051  3247  4440 I octvm_power: Action: set_lcd_mode(ui) for [foreground_change]
06-06 10:04:21.051  3247  4440 I octvm_drv: common drv: platform_set_lcd_mode -> platform not support
06-06 10:04:21.051  2533  2887 I octvm   : task pid 2900 have been add to group sys_standby.
06-06 10:04:21.049  2887  2887 W EventReader: type=1400 audit(0.0:530): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.051  2533  2887 I octvm   : task pid 4553 have been add to group sys_standby.
06-06 10:04:21.051  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks max single write time: 0ms
06-06 10:04:21.051  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks total time consume: 0ms
06-06 10:04:21.051  3247  4440 I octvm_power: onPowerModeChanged[normal] called
06-06 10:04:21.052  2875  3093 I FirstNotificationController: handleUnlockState: stoped
06-06 10:04:21.055  1497  2996 I Timeline: Timeline: App_transition_ready time:973254
06-06 10:04:21.055  1976  1976 V PhoneStatusBarPolicy: updateManagedProfile: mManagedProfileFocused: false mKeyguardVisible: true
06-06 10:04:21.055  1497  2996 I Timeline: Timeline: App_transition_stopped time:973255
06-06 10:04:21.059  1497  2996 E ActivityManager: Invalid thumbnail dimensions: 0x0
06-06 10:04:21.059  4553  4553 W .securitycenter: type=1400 audit(0.0:531): avc: denied { search } for name="tmp" dev="dm-0" ino=28 scontext=u:r:system_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
06-06 10:04:21.066  4553  4553 W asset   : Asset path /data/local/tmp/android-debug.apk is neither a directory nor file (type=0).
06-06 10:04:21.066  4553  4553 D AdbInstallActivity:  parsePackage is null , path :/data/local/tmp/android-debug.apk
06-06 10:04:21.059  4553  4553 W .securitycenter: type=1400 audit(0.0:532): avc: denied { search } for name="tmp" dev="dm-0" ino=28 scontext=u:r:system_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
06-06 10:04:21.072  1497  2230 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.072  1497  2230 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.072  1497  2230 E         : Service not available yet
06-06 10:04:21.072  1497  2230 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.073  1497  2230 E         : WFDMMServiceClient ctor Context = 0x0, Cb = 0x0
06-06 10:04:21.073  1497  2230 E         : getWFDMMServiceInstance get new Instance
06-06 10:04:21.073  1497  2230 E         : Service not available yet
06-06 10:04:21.073  1497  2230 E         : WFDMMServiceClient::~WFDMMServiceClient
06-06 10:04:21.075  1497  2230 E ActivityManager: Invalid thumbnail dimensions: 0x0
06-06 10:04:21.076  2875  3077 D PowerKeeperEventLogManager: notifyForegroundCompomentChanged ComponentInfo{com.android.settings/com.android.settings.Settings$WifiSettingsActivity}
06-06 10:04:21.069  2887  2887 W EventReader: type=1400 audit(0.0:533): avc: denied { search } for name="756" dev="proc" ino=16099 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=dir permissive=0
06-06 10:04:21.076  1497  2230 I Timeline: Timeline: App_transition_ready time:973275
06-06 10:04:21.076  1497  2230 I Timeline: Timeline: App_transition_stopped time:973275
06-06 10:04:21.076  2533  2887 I octvm   : task pid 2060 have been add to group sys_standby.
06-06 10:04:21.076  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks max single write time: 0ms
06-06 10:04:21.076  2533  2887 I octvm   : [sys_standby]cgroup_add_tasks total time consume: 0ms
06-06 10:04:21.077  1976  1976 V PhoneStatusBarPolicy: updateManagedProfile: mManagedProfileFocused: false mKeyguardVisible: true
06-06 10:04:21.090 13400 13400 I art     : System.exit called, status: 1
06-06 10:04:21.090 13400 13400 I AndroidRuntime: VM exiting with result code 1.
06-06 10:04:21.100  2060  2130 V MI_STAT : disabled local event upload
但这不是错误字符串,只是警告和调试。 还有一句奇怪的话:

06-06 10:04:21.059  1497  2996 E ActivityManager: Invalid thumbnail dimensions: 0x0
但我不知道这是否是个问题

我还尝试通过adb安装一些其他应用程序,而不仅仅是自编的。但没有结果

  • 在开发者模式下禁用“通过USB验证应用”选项,然后再次尝试安装。它应该可以按照链接中指出的那样工作
    同样的设备也有同样的问题

    这就是小米的问题,这里有一个解决方案:

  • 转到“安全”应用程序并点击右上角的“选项”

  • 向下滚动到“功能设置”组,并查找“权限”

  • 在那个里关闭“通过USB安装”选项,该选项通过USB管理应用程序的安装,但不允许

  • 在最新的Redmi设备上

    设置>其他设置>开发人员选项>开发人员选项:选中通过USB安装选项


    祝你好运

    在MIUI8中,转到开发者设置并切换“通过USB安装”以启用它。

    我以前也遇到过同样的问题。以下是我的解决方案:

    cd android
    ./gradlew clean
    
  • 转到设置→ 在系统中找到开发者选项,然后单击
  • 在调试部分打开“通过USB安装”
  • 再次尝试在Android Studio中运行应用程序
    MI设备中遇到了相同的问题,并通过以下步骤解决了问题:

    1) 转到设置

    2) 单击附加设置

    3) 点击开发者选项

    4) 单击“通过USB安装”的切换以启用它

    这个问题将得到解决


    适用于Mi或小米设备

    1) 设置

    2) 附加设置

    3) 开发者选项

    4) 通过USB安装:打开

    这对我来说很好

    注意:不工作,然后尝试以下选项

    1) 登录MI帐户(不适用于所有设备)

    2) 同时禁用启用MIUI优化:设置->附加设置->开发人员选项,接近底部我们将获得此选项

    3) 必须启用“开发人员”选项,并且 用于启用开发人员选项的链接:

    还是不工作

    ->从Mi帐户注销,然后创建新帐户并启用USB调试


    谢谢

    还有一件事:在MIUI开发者模式的一些更新之后,它将被禁用。我确信,这是打开的,但我无法启动应用程序。 所以我重新启用了开发者模式,一切都开始工作了。
    这个问题我已经遇到好几次了。希望有帮助。

    问题似乎出在即时运行功能上。请转到“文件->设置->构建、执行、部署->即时运行”,然后禁用它


    如果上述答案不起作用,希望这能起作用。

    对于Redmi和Mi设备,请关闭MIUI优化

    设置>附加设置>开发人员选项>MIUI优化

    用于MIUI操作系统设备

    1) 转到设置

    2) 向下滚动至附加设置

    3) 您将在底部找到开发者选项

    4) 打开此选项-通过USB安装:打开开关


    通过启用此选项,它在我的MIUI8设备中发挥作用。

    有时应用程序生成错误:签名错误或对齐错误,并报告错误


    检查jarsigner和zipaligned命令

    关于配有MIUI8.3(安卓6)的小米Mi5s小米Rom:

    设置/其他设置/开发人员选项/ 打开:允许USB调试、允许USB安装和允许USB调试(安全选项)


    {很抱歉翻译,我的设备有西班牙语}

    关闭开发者设置的Miui优化,然后重新启动手机。 这对我有用。
    设置>附加设置>开发者选项>MIUI优化

    Im使用小米红米Prime 3S, 以上方法中没有一种对我有效。这让我很沮丧

    我尝试的是,我从Mi帐户注销,然后创建新帐户。 塔达。。。之后,我可以启用USB调试。
    希望这有帮助。

    如果您的交换机通过USB安装打开,并且出现“设备暂时受限”错误,请应用任何默认的移动主题。如果应用了任何其他开发人员主题,那么它将不允许您打开“通过USB安装”。这对我很有用。

    我尝试了上述所有步骤,但都失败了

    例如,
    通过数据连接连接到internet
    关闭MIUI优化并重新启动
    ,从安全设置中打开
    通过USB安装等

    然后我找到了解决办法

    步骤:

    • 安装
    • 设置
      中国上海
      服务器
    • 尝试从开发者选项打开
      通过USB安装

    仅此而已。

    1设置

    2个附加设置

    3个开发者选项

    4个开发者选项:检查通过USB安装选项。


    这是小米的问题,如果可能的话,将MIUI更新到最新版本 然后去 设置>其他设置>开发人员选项>开发人员选项:检查通过USB安装选项

    这解决了我的问题,希望也能解决你的问题
    cd android
    ./gradlew clean