'Failure [INSTALL_CANCELED_BY_USER] on Xiaomi device
I bought a Xiaomi Redmi 4x yesterday and I can't debug my apps in this device.
I already enabled the Developer Options in the device, switch on to USB Debugging, install the USB Drivers and accepted the RSA debugging fingerprint pop that appears when I plug it on USB port for the first time.
So, I select the "Xiaomi Redmi 4X (Android 6.0 - API 23)" in devices list of Visual Studio, click in Run (or deploy) and see this error:
>Detecting installed packages...
>Removing old runtime: Mono.Android.DebugRuntime...
>Target device is arm64-v8a.
>Installing the Mono shared runtime (debug - 1505313604)...
>10% ... 3520kb of 35035kb copied
>20% ... 7040kb of 35035kb copied
>30% ... 10560kb of 35035kb copied
>40% ... 14016kb of 35035kb copied
>50% ... 17536kb of 35035kb copied
>60% ... 21056kb of 35035kb copied
>70% ... 24576kb of 35035kb copied
>80% ... 28032kb of 35035kb copied
>90% ... 31552kb of 35035kb copied
>100% ... 35035kb of 35035kb copied
> Deployment failed
>Mono.AndroidTools.InstallFailedException: Unexpected install output: pkg: /data/local/tmp/Mono.Android.DebugRuntime-debug.apk
>Failure [INSTALL_CANCELED_BY_USER]
>
> at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)
> at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass94_0.<InstallPackage>b__0(Task`1 t)
> at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
> at System.Threading.Tasks.Task.Execute()
>Unexpected install output: pkg: /data/local/tmp/Mono.Android.DebugRuntime-debug.apk
>Failure [INSTALL_CANCELED_BY_USER]
>
>Creating "obj\Debug\upload.flag" because "AlwaysCreate" was specified.
>Creating directory "obj\.cache\".
>Done building project "MyTestApp.csproj".
>Build succeeded.
>An error occured. See full exception on logs for more details.
>Unexpected install output: pkg: /data/local/tmp/Mono.Android.DebugRuntime-debug.apk
>Failure [INSTALL_CANCELED_BY_USER]
>
>
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
This occurs with all my apps and just in this Xiaomi device. In other brand devices and emulators, the debug works normally.
Just to complement, I have this problem http://en.miui.com/thread-544718-1-1.html and even following the instructions, I can't make the "Install via USB" works.
There is any solution to debug in this device?
Solution 1:[1]
Just to help anyone who have the same problem: it was entirely related to the "Install via USB" option in the Developer mode, that MIUI would not let me activate. After numerous attempts and reboots of the device, it finally activated and the deploy worked at the same time.
Solution 2:[2]
In MIUI the UI does some of the optimization for some reason, but this comes out to be an error while running the app on the phone through Android Studio. We need to stop the optimization:
Go to -> Settings -> Switch on the developer option (hope you know) -> Go to developer settings -> Turn off MIUI optimization
I hope this works for you. ;)
Solution 3:[3]
Do step by step:
Turn on
Install via USB
in Settings>Additional Settings>Developer Options>Install Via USB(Under Debugging Section) --> Need active Mi account.Deploy app.
Wait for several seconds, a notification on your Xiaomi phone will display
Install via USB
, then you need touchInstall
to allow the app to be deployed on your device. You can choose to remember this option.
Solution 4:[4]
Good afternoon,
I had the same problem, I have a Xiaomi mi 8 lite phone. I solved this problem by disabling MIUI optimization.
I haven't tested on many models / brands to see if this will work.
Solution 5:[5]
I had solved this by turning off the MIUI Optimization. In case you did not get the MIUI Optimization option in your developer settings, just you need to reset the default values option by tapping it multiple times.
Solution 6:[6]
Inside the developer option of Xiaomi device click on install via USB. It works without any reboot
Solution 7:[7]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Phat Nguyen |
Solution 2 | Mihai Chelaru |
Solution 3 | TommySM |
Solution 4 | user12771441 |
Solution 5 | Nimantha |
Solution 6 | Birendra Rai |
Solution 7 | Jaibey Pisco Fatama |