【问题标题】:Adb install failure: INSTALL_CANCELED_BY_USERadb 安装失败:INSTALL_CANCELED_BY_USER
【发布时间】:2016-10-05 03:08:45
【问题描述】:

我尝试通过 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,MIUI 7.2.13,Android 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

我看到 android-debug.apk 何时创建,但我不明白为什么它没有安装。也许关键字符串是:

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  1497  2996 E ActivityManager: Invalid thumbnail dimensions: 0x0

但不知道是不是有问题。

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

【问题讨论】:

  • 您的手机上是否已经安装了该应用程序?如果是这样,请先卸载,然后重试。另一种选择是使用adb install -r /path/to/apk/file.apk,如果它已经存在,它将安装在应用程序上。
  • 我尝试卸载它,并尝试使用 adb install -r,但它没有帮助我。
  • 你能解决这个问题吗?
  • 你好 Dmitry Skryabin,我有同样的手机,和你有同样的问题。我无法在手机上安装任何东西。未知来源已开启,我可以将应用程序从存储安装到设备,但我无法从 Android Studio 或 Xamarin 调试应用程序。我觉得这是一个 OS/小米 Mi5 的东西。要去小米论坛问同样的问题。
  • @Yudhistre,感谢您的评论。我已经临时切换到 iPhone 模拟器上调试,这对我的目的来说已经足够了。

标签: android adb ionic2


【解决方案1】:

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

所以,这是小米的麻烦,这里有一个解决这个问题的方法:

  1. 进入“安全”应用,点击右上角的“选项”

  2. 向下滚动到“功能设置”组,然后查找“权限”

  3. 在此处关闭“通过 USB 安装”选项,该选项通过 USB 管理应用程序的安装并且不允许。

在最新的 Redmi 设备上

设置 > 其他设置 > 开发者选项 > 开发者选项:勾选通过 USB 安装选项

祝你好运!

【讨论】:

  • 是的,它有效!对其他用户的提示:在俄语中(来自 xiaomi.eu 的固件)此参数名为“Менеджер установки”。
  • 较新版本的安全应用不再有该选项。 Victor Lopez 的答案对我有用
  • 在最近的更新中,除非您登录 mi 帐户,否则通过 USB 安装将不起作用。疯了吧!!!知道如何绕过这个荒谬的功能吗?
  • 令人惊讶的是需要 SIM 卡才能启用此功能。叹息!
  • 它要先授权,不允许在没有它的情况下启用install via usb。注册不会在电子邮件和手机上发送验证码。 WTF?!
【解决方案2】:

MI 设备 中遇到了同样的问题,并按照以下步骤解决了问题:

1) 转到设置

2) 点击其他设置

3) 点击开发者选项

4) 点击Install via USB的切换开关以启用它

问题将得到解决。

【讨论】:

  • 当我打开通过 USB 安装时,它要求登录 MI 帐户。如何跳过这一步?
  • @Chandrakanth 你必须登录你的 MI 帐户很遗憾你不能跳过它
  • Note 4 上不存在此菜单项。
  • 当我尝试这个时,它说“此设备暂时受限”,有什么建议吗?
  • 还有redmi note 4说“插入sim卡”,不知道为什么需要sim卡
【解决方案3】:

在 MIUI 8 中,进入开发者设置并切换“通过 USB 安装”以启用它。

【讨论】:

  • 它还要求 MIUI 帐户启用 Install Over USB 设置。
  • 我已启用 MIUI 帐户,但仍未启用“通过 USB 安装”
  • 解决方案:如果您在启用“通过 USB 安装”时遇到问题,只需断开 Wifi 并启用它。它会起作用的!
【解决方案4】:

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

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

【讨论】:

  • 哇我好讨厌MIUI操作系统,这就是“用心铺成的地狱之路”这个“MIUI优化”浪费我太多时间的例子。谢谢
  • 确实,如果您禁用上述选项,则无需启用“通过USB安装应用程序”选项并登录小米帐户- adb安装“正常工作”。非常感谢您的建议!
  • 成功了!非常感谢!
【解决方案5】:

适用于小米或小米设备

1) 设置

2) 附加设置

3) 开发者选项

4) 通过 USB 安装:打开

对我来说很好用。

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

1) 登录小米帐号(不适用于所有设备)

2) 同时禁用开启 MIUI 优化:设置 -> 附加设置 -> 开发者选项,靠近底部我们会得到这个选项。

3) 必须启用开发者选项并且 开启开发者选项链接: Description here

还是不行?

-> 退出小米账号,创建新账号并开启USB调试。

谢谢

【讨论】:

  • 禁用开启MIUI优化让我可以跳过登录小米账户-我仍然无法启用通过USB安装设置,但它不是没有必要了,adb install 没有它就可以工作。谢谢!
【解决方案6】:

问题似乎与即时运行功能有关。转到“文件 -> 设置 -> 构建、执行、部署 -> 即时运行”并禁用它。

如果以上答案不起作用,希望这能起作用..

【讨论】:

  • 为我的小米 MI6 工作。
【解决方案7】:

1 设置

2 附加设置

3 个开发者选项

4 开发者选项:勾选通过 USB 安装选项。

【讨论】:

    【解决方案8】:

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

    【讨论】:

      【解决方案9】:

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

      1. 进入设置 → 在系统中找到开发者选项,然后点击。
      2. 在调试部分打开通过 USB 安装
      3. 再次尝试在 Android Studio 中运行应用

      【讨论】:

        【解决方案10】:

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

        例如,connect to the internet with Data connectionTurning off the MIUI optimization and reboot、从安全设置等中打开 Install via USB

        然后我找到了解决办法。

        步骤:

        • 安装PlexVPN
        • 设置China-Shanghai服务器
        • 尝试从开发者选项开启Install via USB

        就是这样。

        【讨论】:

        • 除非它需要应用内这样做
        【解决方案11】:

        对于 MIUI 操作系统设备

        1) 转到设置

        2) 向下滚动至其他设置

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

        4) 开启此功能 - 通过 USB 安装:开启

        打开它,它就可以在我的 MIUI8 设备中发挥作用。

        【讨论】:

          【解决方案12】:

          在带有 MIUI8.3 (Android 6) Xiaomi.EU Rom 的小米 Mi5s 上:

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

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

          【讨论】:

            【解决方案13】:

            另外,任何应用锁密码都需要通过设置>应用锁来解除,输入设置的密码,解除锁。这在 REDMI 4A 上对我有用

            【讨论】:

              【解决方案14】:
              1. 在开发者模式下禁用“通过 USB 验证应用程序”选项并尝试再次安装。它应该按照链接 https://stackoverflow.com/a/29742394/2559990 中的说明工作。

              【讨论】:

              • 我看到了这个链接,但它对我没有帮助。我尝试禁用它,启用它并在更改后重新启动设备,但没有结果:(我还尝试在设备中重新启用开发人员模式 - 均未成功。我更新了主帖子,从设备添加了更多日志。
              【解决方案15】:

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

              【讨论】:

                【解决方案16】:

                我用的是小米红米Prime 3S, 上述方法都不适合我。这让我很沮丧

                我尝试的是,我从 Mi 帐户退出,然后创建新帐户。 tada ...之后我可以启用USB调试。 希望这会有所帮助。

                【讨论】:

                  【解决方案17】:

                  如果您的开关通过 USB 安装打开并且您收到“设备暂时受限”错误,请应用任何默认移动主题。如果应用了任何其他开发者主题,则它不会允许您打开通过 USB 安装。这对我有用。

                  【讨论】:

                    【解决方案18】:

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

                    检查您的 jarsigner 和 zipaligned 命令。

                    【讨论】:

                      【解决方案19】:

                      这是我的情况(使用 react-native) 我在安装时按 Ctr+C 中断,然后发生此错误。 - 解决方案:

                      cd android
                      ./gradlew clean
                      

                      【讨论】:

                        【解决方案20】:

                        当我转到 settings &gt; Additional Settings &gt; Developer Options &gt; activated USB debugging 并激活通过 USB 安装并激活 USB 调试(安全设置)并激活通过 USB 验证应用程序时,我有一个 Xiaomi 8。并且你可以验证你是否被激活打开MIUI optimisation,如果没有激活那么激活。然后你重启你的设备,你就可以为我运行你的应用程序了。

                        【讨论】:

                          【解决方案21】:

                          这是小米的问题 如果可能,请将 MIUI 更新到最新版本 然后去 设置 > 附加设置 > 开发者选项 > 开发者选项:勾选通过 USB 安装选项。

                          这解决了我的问题希望它也能解决你的问题 祝你好运!

                          猜你喜欢
                          • 1970-01-01
                          • 1970-01-01
                          • 1970-01-01
                          • 1970-01-01
                          • 1970-01-01
                          • 1970-01-01
                          • 2014-10-06
                          • 2023-03-06
                          相关资源
                          最近更新 更多