简体   繁体   中英

Visual Studio 2019 error XA0136: The run as command failed with 'run as: package has corrupt installation

I am trying to deploy an android app built on C# .NET (in debug mode) to Nokia 5 (Android Pie) using Visual Studio 2019 v16.10.3, but it always fails with error :

XA0136: The 'run-as' command failed with 'run-as: package has corrupt installation: com.ashish.myapp.'

However it deploys and runs successfully in the same device when I turn off the Fast Deployment mode. It also deploys successfully in android emulator with Fast Deployment mode on.

Well obviously I am able to test my builds but it is quite difficult to test gestures on emulator, on the other hand it takes almost 1 minute to deploy an app on a physical device when Fast Deployment mode is off .

Do anyone has any solution?

You could speed up by configuring your project. You could check the configurations in Debug Builds and Release builds.

  1. Enable Fast Deployment (If you do not want this, try the following steps.)

Without Fast Deployment, Xamarin.Android has to build an APK every time there's change in your project, regardless of size or scope.

  1. UnCheck Multi-Dex

Enable Multi-Dex should be unchecked: unless your app fails to build without it.

  1. Uncheck these Release-only Settings

Using AOT, Linking, or a Code Shrinker for Debug configurations is not that helpful. They will slow down your Debug builds with no real benefit.

For more details, you could check the link below. Some other tricks would be helpful too. https://devblogs.microsoft.com/xamarin/optimize-xamarin-android-builds/

Link SDKs and Frameworks

You could try to utilize the Linker for Release Configuration builds.

On Android Build Settings, generally, we could use Shared Mono Runtime and Fast Assembly Deployment like deploy assemblies to a directory on the device instead of bundling them in the APK. Link SDK assemblies only would reduce the time as well.

The more detailed information about speed-up the build time you could find here. https://github.com/brminnick/ImproveXamarinBuildTimes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM