question

VeresZoltnNoel-2550 avatar image
0 Votes"
VeresZoltnNoel-2550 asked VeresZoltnNoel-2550 answered

Got an error message after i try to run a xamarin code on my Xiaomi mi 9

I enabled the developer function on my phone, enabled trubleshooting, checked with powershell that my device is detectable on my PC.
(Also corrected every non english letter l used before like ó to o and é to e).
Everything seems to be great at this point, but after i want to create a xamarin program and run it on my phone i will get this error message every time:


Error ADB0010: Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in C:\A\1\16\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 346
at Mono.AndroidTools.AndroidDevice.<>c_DisplayClass100_0.<InstallPackage>b0(Task`1 t) in C:\A\1\16\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 803
at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at AndroidDeviceExtensions.<PushAndInstallPackageAsync>d
12.MoveNext() in C:\A\1\16\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 206
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at AndroidDeviceExtensions.<PushAndInstallPackageAsync>d
12.MoveNext() in C:\A\1\16\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 223
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.Android.Tasks.FastDeploy.<InstallPackage>d
_101.MoveNext() in /Users/builder/azdo/work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 338
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Xamarin.Android.Tasks.FastDeploy.<InstallPackage>d
_101.MoveNext() in /Users/builder/azdo/work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 355
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Xamarin.Android.Tasks.FastDeploy.<RunTaskAsync>d
_96.MoveNext() in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line 212 0

What should i do?

dotnet-xamarinforms
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I googled that error and found a SO post with the same issue and it appears to have a fix:
https://stackoverflow.com/questions/46499742/failure-install-canceled-by-user-on-xiaomi-device

1 Vote 1 ·

Thank you so much, i found the solution there!
I dont know, how I missed that post. Maybe my eyes arent the same as before.

0 Votes 0 ·

1 Answer

VeresZoltnNoel-2550 avatar image
0 Votes"
VeresZoltnNoel-2550 answered

For me this was the solution:

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.