我尝试通过 adb 安装应用程序并收到错误:
I try to install app via adb and get a error:
$ ./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.开发者模式已启用.如何解决这个问题?
In device I do nothing in this moment. Device is Xiaomi MI5, MIUI 7.2.13, Android 6.0. Developer mode enabled. How to fix this?
我在尝试运行ionic run android"命令时遇到同样的错误.
The same error I get when try to run "ionic run android" command.
UPD
这是安装程序时adb logcat"命令的日志:
Here is logs from 'adb logcat' command getting in moment of installation program:
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 何时创建,但我不明白为什么它没有安装.也许关键字符串是:
I see when android-debug.apk creates, but I don't understand why it's not installs. 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.
我还尝试通过 adb 安装其他一些应用程序,而不仅仅是自己编写的.但没有结果.
Also I tried to install via adb some other apps, not only self-written. 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:
进入安全"应用,点击右上角的选项"
Go to the "Security" application and tap "Options" at top right corner
向下滚动到功能设置"组,然后查找权限"
Scroll down to "Feature Settings" group, and look for "Permissions"
在此处关闭通过 USB 安装"选项,该选项通过 USB 管理应用程序的安装并且不允许.
At there switch off "Install via USB" option, which manages installation of the apps via USB and doesn't allow it.
在最新的 Redmi 设备上
设置 > 其他设置 > 开发者选项 > 开发者选项:勾选通过 USB 安装选项.
Settings > Additional Settings > Developer Options > Developer options: Check the Install via USB option.
祝你好运!
这篇关于adb 安装失败:INSTALL_CANCELED_BY_USER的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!