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

Veres Zoltán Noel 96 Reputation points
2021-09-10T14:11:32.973+00:00

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>b__0(Task1 t) in C:\A\1\16\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 803 at System.Threading.Tasks.ContinuationTaskFromResultTask1.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?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,296 questions
{count} votes

Accepted answer
  1. Veres Zoltán Noel 96 Reputation points
    2021-09-12T19:27:12.087+00:00

    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

    0 comments No comments

0 additional answers

Sort by: Most helpful