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?
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.
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. ;)
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 touch Install
to allow the app to be deployed on your device. You can choose to remember this option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With