Search code examples
androidadbandroid-install-apkandroid-hardwarexiaomi

Android Install on Device Failure [INSTALL_CANCELED_BY_USER]


I'm using Android Studio to connect to run app in my Xiaomi Redmi Note 3G device. My device is already found in the Choose Device Dialog, but I keep getting the [INSTALL_CANCELED_BY_USER] error :

Waiting for device.
Target device: xiaomi-hm_note_1w-SSE6Y97PFYQCRK45
Uploading file 
local path: C:\Users\Anthony\AndroidStudioProjects\UASProject\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.si.UASPROJECT
Installing com.si.UASPROJECT
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.si.UASPROJECT"   
pkg: /data/local/tmp/com.si.UASPROJECT   
Failure [INSTALL_CANCELED_BY_USER]

I tried looking for solutions online, but there's no mention of Failure [INSTALL_CANCELED_BY_USER] error.


Solution

  • Happens to my Xiaomi phone after updated it to MIUI 8. Took me hours to figure it out!

    Check the followings if you're a victim too:

    1. Go to Settings -> Permissions -> Install via USB: Uncheck your App if it's listed.
    2. Go to Settings -> Additional Settings -> Privacy: Check the Unknown Sources option.
    3. Finally go to Settings -> Additional Settings -> Developer options: Check the Install via USB option.

    Update (MIUI 8):

    Signin in to MI account is required to enable Install via USB option.

    Update 2

    For some devices (e.g. Redmi) you might need to turn off MIUI Optimization and reboot your phone.

    Settings > Additional Settings > Developer Options > MIUI Optimization

    P.S. don't update MIUI unless necessary!

    May the victims saved