简体   繁体   English

Adb 安装失败:INSTALL_CANCELED_BY_USER

[英]Adb install failure: INSTALL_CANCELED_BY_USER

I try to install app via adb and get a error:我尝试通过 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]

In device I do nothing in this moment.在设备中,我现在什么都不做。 Device is Xiaomi MI5, MIUI 7.2.13, Android 6.0.设备是小米5,MIUI 7.2.13,Android 6.0。 Developer mode enabled.开发者模式已启用。 How to fix this?如何解决这个问题?

The same error I get when try to run "ionic run android" command.尝试运行“ionic run android”命令时出现同样的错误。

UPD更新程序

Here is logs from 'adb logcat' command getting in moment of installation program:这是在安装程序的时刻从“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

I see when android-debug.apk creates, but I don't understand why it's not installs.我看到 android-debug.apk 何时创建,但我不明白为什么它没有安装。 Maybe the key strings is:也许关键字符串是:

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

but this is not error strings, just warning and debug.但这不是错误字符串,只是警告和调试。 Also strange line:还有奇怪的线:

06-06 10:04:21.059  1497  2996 E ActivityManager: Invalid thumbnail dimensions: 0x0

but I don't know if it is a problem.但我不知道这是否是一个问题。

Also I tried to install via adb some other apps, not only self-written.我还尝试通过 adb 安装其他一些应用程序,而不仅仅是自己编写的。 But no results.但没有结果。

The same trouble with same device has been here.同样的问题也出现在这里。

So, it's Xiaomi trouble, and here is a solution for this problem:所以,这是小米的问题,这里是这个问题的解决方案:

  1. Go to the "Security" application and tap "Options" at top right corner转到“安全”应用程序并点击右上角的“选项”

  2. Scroll down to "Feature Settings" group, and look for "Permissions"向下滚动到“功能设置”组,然后查找“权限”

  3. At there switch off "Install via USB" option, which manages installation of the apps via USB and doesn't allow it.在那里关闭“通过 USB 安装”选项,该选项通过 USB 管理应用程序的安装,但不允许这样做。

On Latest Redmi Device在最新的 Redmi 设备上

Settings > Additional Settings > Developer Options > Developer options: Check the Install via USB option .设置 > 其他设置 > 开发人员选项 > 开发人员选项:选中通过 USB 安装选项

Good luck!祝你好运!

Faced the same Issue in MI devices and figured out the problem by following these Steps :MI 设备中遇到了同样的问题,并按照以下步骤解决了问题:

1) Go to Setting 1) 进入设置

2) Click on Additional Settings 2)点击附加设置

3) Click on Developer Options 3)点击开发者选项

4) Click toggle of Install via USB to enable it 4) 单击通过 USB 安装的切换开关以启用它

and the issue will be resolved.问题将得到解决。

在此处输入图片说明

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

For Redmi and Mi devices turn off MIUI Optimization红米和小米设备关闭MIUI优化

Settings > Additional Settings > Developer Options > MIUI Optimization设置 > 附加设置 > 开发者选项 > MIUI 优化

For Mi or Xiaomi Device对于 Mi 或小米设备

1) Setting 1)设置

2) Additional Setting 2)附加设置

3) Developer option 3)开发者选项

4) Install via USB : Toggle On 4)通过 USB 安装:打开

It is working fine for me.它对我来说很好。

Note : Not working then try following options also注意:不工作然后尝试以下选项

1) Sign to MI account (Not applicable to all devices) 1) 登录小米账号(不适用于所有设备)

2) Also Disable Turn on MIUI optimization : Setting -> Additional Setting -> Developer Option, near bottom we will get this option. 2)同时禁用开启MIUI优化:设置->附加设置->开发者选项,靠近底部我们会得到这个选项。

3) Developer option must be enabled and Link for enabling developer option: Description here 3) 必须启用开发者选项和启用开发者选项的链接: 此处说明

Still not working?还是行不通?

-> signed out from Mi Account and then created new account and enable USB Debugging. -> 退出小米帐号,然后创建新帐号并启用 USB 调试。

Thanks谢谢

The problem seems to be with Instant Run feature.Go to " File -> Settings -> Build, Execution, Deployment -> Instant Run " and just disable it.问题似乎出在 Instant Run 功能上。转到“文件 -> 设置 -> 构建、执行、部署 -> 即时运行”并禁用它。

Hope this works if above answers doesnt work..如果以上答案不起作用,希望这有效..

1 Settings 1 设置

2 Additional Settings 2 附加设置

3 Developer Options 3 开发者选项

4 Developer options: Check the Install via USB option. 4 开发者选项:勾选通过 USB 安装选项。

在此处输入图片说明

Turn off Miui Optimizations on Developer Settings, then Restart the phone.在开发者设置中关闭Miui 优化,然后重启手机。 it worked for me.它对我有用。 Settings > Additional Settings > Developer Options > MIUI Optimization设置> 其他设置 > 开发者选项 > MIUI优化

I had the same problem before.我以前也遇到过同样的问题。 Here was my solution:这是我的解决方案:

  1. Go to Setting → find Developer options in System , and click.转到设置→在系统中找到开发人员选项,然后单击。
  2. TURN ON install via USB in the Debuging section.在调试部分打开通过 USB 安装
  3. Try Run app in Android Studio again!再次尝试在 Android Studio 中运行应用程序

I tried all the steps described above but failed.我尝试了上述所有步骤,但失败了。

Like, connect to the internet with Data connection , Turning off the MIUI optimization and reboot , Turning on Install via USB from Security settings etc.例如, connect to the internet with Data connectionTurning off the MIUI optimization and reboot ,从安全设置中打开Install via USB等。

Then I found a solution.然后我找到了解决方案。

Steps:脚步:

  • Install PlexVPN .安装PlexVPN
  • set China-Shanghai server设置China-Shanghai服务器
  • Try turning on Install via USB from Developer option.尝试从开发人员选项打开Install via USB

That's all.就这样。

  1. 在开发人员模式下禁用“通过 USB 验证应用程序”选项并尝试再次安装。它应该像链接https://stackoverflow.com/a/29742394/2559990 中指出的那样工作。

For MIUI OS Device对于 MIUI OS 设备

1) Go to Setting 1) 进入设置

2) Scroll down to Additional Setting 2)向下滚动到附加设置

3) You will find Developer option at bottom 3)您会在底部找到开发人员选项

4) Turn this on - Install via USB: Toggle On 4)打开它 -通过 USB 安装:打开

By turning this on, It is working charm in my MIUI8 device.通过打开它,它在我的 MIUI8 设备中很有用。

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

Settings/ Other Settings / Developer Options / Switch on: Allow USB Debug, Allow USB install and Allow USB Debug (Security options)设置/其他设置/开发人员选项/打开:允许 USB 调试、允许 USB 安装和允许 USB 调试(安全选项)

{Sorry for the translation, my device has spanish} {抱歉翻译,我的设备有西班牙文}

In addition, any app lock password should be removed by SETTINGS>APP LOCK ,enter the set password and remove the lock.此外,任何应用锁密码都应通过设置>应用锁来删除,输入设置的密码并删除锁。 This worked for me on REDMI 4A这在 REDMI 4A 上对我有用

One more thing: after some updates of MIUI developer mode becomes disabled.还有一件事:在 MIUI 开发者模式的一些更新之后,它被禁用了。 I was sure, that is was turned on, but i couldn't start the application.我确定,那是打开的,但我无法启动应用程序。 So i reenabled developer mode and everything started to work.所以我重新启用了开发者模式,一切都开始工作了。 I've encountered this problem several times.我已经多次遇到这个问题。 Hope it helps.希望能帮助到你。

Sometimes the application is bad generated: bad signed or bad aligned and report a mistake.有时应用程序生成错误:签名错误或对齐错误并报告错误。

Check your jarsigner and zipaligned commands.检查您的 jarsigner 和 zipaligned 命令。

Im using Xiaomi Redmi Prime 3S, Non of the above method worked for me.我使用的是小米红米 Prime 3S,上述方法对我不起作用。 This frustrated me这让我很沮丧

what i tried was, i signed out from Mi Account and then created new account.我尝试的是,我从 Mi 帐户注销,然后创建了新帐户。 tada... after that i can enable USB Debugging. tada...之后我可以启用USB调试。 Hope this helps.希望这可以帮助。

If your switch Install by USB on and you are getting "the device is temporarily restricted" error, then apply any of the default mobile themes.如果您的开关通过 USB 安装并且您收到“设备暂时受限”错误,请应用任何默认移动主题。 If any other developer theme is applied then it will not Allow you to switch Install by USB on.如果应用了任何其他开发人员主题,则它不会允许您打开通过 USB 安装。 This works for me.这对我有用。

For anyone on MIUI 13 and above - MIUI Optimization option is hidden, so you have to go to Developer Options -> Reset to default values and press it multiple times so that MIUI Optimization appears - only then you can disable it.对于 MIUI 13 及更高版本的任何人 - MIUI 优化选项是隐藏的,因此你必须 go 到开发人员选项 -> 重置为默认值并多次按下它以便出现 MIUI 优化 - 只有这样你才能禁用它。

This is my case (using react-native ) I press Ctr+C to interrupt while installing and after that this error occured.这是我的情况(使用react-native )我在安装时按 Ctr+C 中断,然后发生此错误。 - solution: - 解决方案:

cd android
./gradlew clean

I have a Xiaomi 8 when I go to settings > Additional Settings > Developer Options > activated USB debugging and activated install via USB and activated USB debugging (security setting) and activated verify apps over USB.当我转到settings > Additional Settings > Developer Options > activated USB debugging并激活通过 USB 安装并激活 USB 调试(安全设置)并激活通过 USB 验证应用程序时,我有一个Xiaomi 8 and you can verify if you are activated Turn on MIUI optimisation , if don't activated so active.并且您可以验证您是否已激活 打开MIUI optimisation ,如果不激活那么激活。 And you reboot your device and your can run your application for me it ok.然后你重启你的设备,你就可以为我运行你的应用程序了。

Its a Xiaomi's issue If possible update MIUI to latest version then go to Settings > Additional Settings > Developer Options > Developer options: Check the Install via USB option.这是小米的问题如果可能,将 MIUI 更新到最新版本,然后转到设置 > 其他设置 > 开发人员选项 > 开发人员选项:选中通过 USB 安装选项。

This solved my issue hope it will also solve yours good luck!这解决了我的问题希望它也能解决你的好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM