Android Install on Device Failure [INSTALL_CANCELED_BY_USER]

AndroidAdbAndroid Install-ApkAndroid HardwareXiaomi

Android Problem Overview


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.

Android Solutions


Solution 1 - Android

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

Solution 2 - Android

I have same problem before, here is my solution:

Step 1: Go to "Setting" → find "Developer options" in System, and click.

Step 2: TURN ON "Verify apps over USB" in Debbuging section.

Step 3: Try "Run app" in Android Studio again!

Solution 3 - Android

> Turn off Miui Optimizations on Developer Settings, then Restart the phone.

Solution 4 - Android

Step 1 : Turn on Developer Option (Settings > About Phone > Click 7 Times On "MIUI Version").

Step 2 : Connect Your Device via USB to PC

step 3 : Settings > Additional Settings > Developer Options > Turn On USB Debugging.

Step 4 : Also You Should turn On Settings > Additional Settings > Developer Options > install Via USB

Enjoy Coding ... :-)

Solution 5 - Android

In my case I turn on "Install via USB" and also make sure "USB Debugging" is on.

Solution 6 - Android

if you are at MIUI 8.

> Follow the steps

Step 1: Settings > Additional Settings > Privacy: Check the Unknown Sources option.

Step 2: Settings > Additional Settings > Developer Options > Turn On USB Debugging

Step 3: Settings > Additional Settings > Developer Options > install Via USB

Step 4: Settings > Additional Settings > Developer Options > Turn off MIUI Optimization.

Step 5: Restart your Mobile.

Solution 7 - Android

I had an error of Session 'app': Error Installing APKs in Redmi 3S 6.0.1 MIUI Global 8.2. After turning OFF Instant Run in Android Studio, the error did not occur again. For this, Go to File Menu->Settings->Build, Execution, Deployment->Instant Run->Check OFF Enable Instant Run.

But I wanted to use Instant Run features, so, Go to Settings-> Additional settings->Developer options->Turn off MIUI optimization. Restart phone.

Both of the above methods worked. If the error still occurs, check to Turn on USB debugging and Install via USB.

Solution 8 - Android

  1. Open Security App pre-installed in MIUI
  2. Then click Optimize. Try to achieve 100% score.
  3. Activate developer's option by clicking multiple times on MIUI version. (Everyone knows how to do this)
  4. Then Disable WiFi and switch on install via USB under Developers option while you are connected through Mobile data and under your Xiaomi account.

Solution 9 - Android

"Install via USB" wont work if your Xiaomi phone is running MIUI 8 or above. Looks like when you try to Enable this option, your phone trys to connect to some chinese server and fails.

I got a work around and it worked for me. Idea is to connect to Chinese-Shanghai server through VPN. Try the following:

1.Install PlexVPN from Playstore and login into it. You will a 24 hr free VPN service.

2.Select China-Shanghai server and connect.

3.From developer option in your Xiaomi phone, Enable "Install via USB". You can then disconnect the VPN and logout from PlexVPN.

Enjoy!!

Solution 10 - Android

> IF YOU HAVE TRIED EVERYTHING, TRY THESE STEPS ALSO

Step 0: Turn On MIUI Optimization & Restart.

Step 1: Settings > Additional Settings > Privacy: Check the Unknown Sources option.

Step 2: Settings > Additional Settings > Developer Options > Turn On USB Debugging

Step 3: Settings > Additional Settings > Developer Options > install Via USB

Step 4: Settings > Additional Settings > Developer Options > Turn off MIUI Optimization.

Step 5: Restart your Mobile.

Solution 11 - Android

Sometimes it happens because the user does not accept the installation in time. You can turn off "Monitor apps installed by USB" to override user confirmation.

Solution 12 - Android

Go to Settings-> Additional settings->Developer options->Turn off MIUI optimization You must Turn on USB debugging and Install via USB Hope it help

Solution 13 - Android

Follow the steps

  1. Go to settings -> Additional Settings -> Developer Options(if not found then tap MIUI version in About phone multiple times) -> Turn off MIUI optimization.

  2. GO to settings -> Mi Account -> Sign out(if signed in)-> developer options->turn on Install via USB(sign in page will open) -> Sign in to your mi Account

It should work, if still these steps doesn't work for you then reboot your phone after these two steps

Solution 14 - Android

  • Go to "Setting" → find "Developer options" in System
  • TURN OFF "Verify apps over USB" in Debbuging section.

Solution 15 - Android

I too faced similar issue after updating of Redmi to 8.5.7 OS but none of them mentioned above are worked. When I am trying to turn on Install via USB in developer options it is restricting.. So I did like following

Simply I did:

  1. Logout from Redmi account
  2. Relogin again
  3. Turn on Install via USB in developer options

Update: if you still unable to tun on just switch off Wi-Fi and turn on mobile data and try to switch it on.

This solved my issue.

Solution 16 - Android

in miui 9 u must have access to the INTERNET to make it work

Step 1 : Turn on Developer Option (Settings > About Phone > Click 7 Times On "MIUI Version").

Step 2 : Connect Your Device via USB to PC

step 3 : Settings > Additional Settings > Developer Options > Turn On USB Debugging.

Step 4 : Also You Should turn On Settings > Additional Settings > Developer Options > install Via USB

Solution 17 - Android

for check, sometime just need go to:

  • Settings
  • Permissions
  • Install via USB (turn off your app if exist) It was my case. Thanks @Jiyeh

Solution 18 - Android

You have to in able the install via USB mode, to do that

1.go to Settings=>Aditional setting=>Developer Options=>Install via USB tuggle it on, If you are having trouble tuggeling the option on,

2.You will have to insert a sim in and use a chineese VPN; You can use a vpn of following setting: tpye: L2TP/IPSec PSK server address: vpn959922015.opengw.net IPSec pre-sared key: vpn username: vpn password: vpn

3.And remember to turn on OEM unlocking in the developer options and then appempt to turn on Install via USB;

Solution 19 - Android

All the above instructions should work but if you're using MI Redmi Note 5A or later versions, you'll see that toggling "install via USB" toggles back off.

That's because the new versions somehow requires you to be in China. To fix this, download Windscribe VPN from playstore(it's free to use). Off your wifi and on mobile data. Connect to HongKong.

Go back and toggle "Install via USB". It'll work now. Disconnect the VPN.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAnthony.SView Question on Stackoverflow
Solution 1 - AndroidJiyehView Answer on Stackoverflow
Solution 2 - AndroidHannah ChengView Answer on Stackoverflow
Solution 3 - AndroidSujeet KumarView Answer on Stackoverflow
Solution 4 - Androidsaigopi.meView Answer on Stackoverflow
Solution 5 - AndroidWin Min TunView Answer on Stackoverflow
Solution 6 - AndroidVinesh GoyalView Answer on Stackoverflow
Solution 7 - AndroidStuti VermaView Answer on Stackoverflow
Solution 8 - AndroidPankaj RaneView Answer on Stackoverflow
Solution 9 - AndroidVineet RaviView Answer on Stackoverflow
Solution 10 - AndroidPrashanthView Answer on Stackoverflow
Solution 11 - AndroidDiego Robles GallardoView Answer on Stackoverflow
Solution 12 - AndroidMuhibbullah MuhiView Answer on Stackoverflow
Solution 13 - AndroidDeepak KatariaView Answer on Stackoverflow
Solution 14 - AndroidNikunjView Answer on Stackoverflow
Solution 15 - AndroidShailendra MaddaView Answer on Stackoverflow
Solution 16 - Androidmostafa zaghloulView Answer on Stackoverflow
Solution 17 - Androidnicolas asinovichView Answer on Stackoverflow
Solution 18 - AndroidMechadroidView Answer on Stackoverflow
Solution 19 - AndroidJustice EziefuleView Answer on Stackoverflow