0

I have an app that works great in debug mode, but in release mode it does not give an error that prevents it from building, but it gives the following warning:

MSB3073: The command ""C:\Program Files (x86)\Android\android-sdk\platform-tools\adb" -s emulator-5554 uninstall -k "com.companyname.escmsmauiapp"" exited with code 1.

Version:

Android 13-AP I33

Please find below images for debug and release modes. I'm getting data from the database in debug mode, which is working fine, but I'm unable to fetch the data from the database in release mode, where it is working in debug mode.

Debug Mode:

Debug mode

Release Mode:

Release mode

Please help us fix the issue.

Thanks,

Suresh
  • 1
  • 2

1 Answers1

0

I'm getting data from the database in debug mode, which is working fine, but I'm unable to fetch the data from the database in release mode.

The Android/iOS linkers are removing chunks of the assemblies of your app due to the heavy use of reflection when in Release Mode. You can verify this by adding code as follows in the csproj file as follows :

    <PropertyGroup>
        <AndroidLinkMode>None</AndroidLinkMode>
    </PropertyGroup>

And you can also instruct the linker to keep some of the important assemblies .

Do the following steps:

  1. Add an XML file named Linker.xml to your Android project.
  2. Right click Linker.xml in your Solution Explorer then select Properties.
  3. Change Build Action to LinkDescription.

There is a simimar thread, you can check this case: Entity Framework Core in .NET MAUI/Xamarin.Forms.

Jianwei Sun - MSFT
  • 2,289
  • 1
  • 3
  • 7