1

I once asked a similar question when I faced the same problem here in which the Linker was doing its job a bit too efficiently.

Then I found that it was an issue posted on the MAUI repo on GitHub here.

Jonathan Peppers on the GitHub issue suggested that we should add the following to the csproj

<EmbeddedResource Include="ILLink.Descriptors.xml">
  <LogicalName>ILLink.Descriptors.xml</LogicalName>
</EmbeddedResource>

and create an xml file with the following

<linker>
    <assembly fullname="Mono.Android">
        <type fullname="Android.Runtime.InputStreamAdapter" preserve="methods" />
        <type fullname="Android.Runtime.InputStreamInvoker" preserve="methods" />
    </assembly>
</linker>

I even deleted the bin, obj folders, cleaned, rebuilt the project with no luck. So I then tried <AndroidLinkMode>None</AndroidLinkMode> and even that wasn't working.

When opening the app or starting the app in debug, it crashes on the splash screen, producing the following error message MSB3073: The command ""C:\Program Files (x86)\Android\android-sdk\platform-tools\adb" -s emulator-5554 uninstall -k "com.companyname.medbaseapplication"" exited with code 1. 0

How do I solve this problem?

Edit 1: Here is the build output as requested in the comments https://drive.google.com/file/d/1WHbzMHmqLGFE_3Ne3lW5jwp09ZRYAAWk/view?usp=sharing

Tanaka Mawere
  • 683
  • 1
  • 9
  • 22
  • Please share the build output log. – Isidoros Moulas Feb 04 '23 at 18:55
  • 1
    Try this: 1. Close Visual Studio. 2. In csproj file make `Debug` configuration FULLY identical to `Release` config. via copying xml part from `Release` configuration. 3. Launch Visual Studio and turn on ALL exceptions (Debug - Windows - Exception Settings). 4. Debug the application. And you'll get exception with some information you can work on. To exclude classes/namespaces/etc from the linking use [custom linker configuration xml-file](https://learn.microsoft.com/en-us/xamarin/cross-platform/deploy-test/linker) in your project. – Rafael Feb 04 '23 at 20:50
  • * That Maui issue is a year old, and only applies if you are using Blazor. Are you? If not, I wouldn't do anything mentioned in that issue. * The last paragraph puzzles me. It mentions "uninstall". If you first manually delete app using its icon on device's home screen, then run Release mode from VS, do you still get that error? – ToolmakerSteve Feb 05 '23 at 04:27
  • 1
    Yes, I do. I probably did the most obvious things namely deleting the application on the install device, deleted the bin and obj folders then cleaned and rebuilt the application, deleted it again and run in release again, still didn't work. @ToolmakerSteve. I am thinking of downloading a new emulator and trying it straight in release mode – Tanaka Mawere Feb 05 '23 at 10:59
  • You can also "Factory Reset" an emulator. VS Tools / Options / Android Device Manager. – ToolmakerSteve Feb 05 '23 at 22:07
  • @IsidorosMoulas I added the build output log – Tanaka Mawere Feb 06 '23 at 11:15
  • Have you tried to remove the app from the emulator and run it on debug mode? Not release. – Isidoros Moulas Feb 06 '23 at 12:04
  • @ToolmakerSteve that didn't work too – Tanaka Mawere Feb 06 '23 at 12:06
  • 1
    It is running well and properly in debug. @IsidorosMoulas – Tanaka Mawere Feb 06 '23 at 12:06
  • Just a brainstorming, is splash.svg filename lowercase? – Isidoros Moulas Feb 06 '23 at 15:52
  • If you use Maui Project Template to make a new app, does the new one work in Release mode, on same emulator? – ToolmakerSteve Feb 06 '23 at 19:14
  • @IsidorosMoulas yes it is – Tanaka Mawere Feb 07 '23 at 06:05
  • @ToolmakerSteve I made a new .NET MAUI app and oddly enough, that same uninstall message pops up but this time it doesn't crash the application. – Tanaka Mawere Feb 10 '23 at 08:45
  • You can copy the code in the old project into the new maui app and test again. – Liyun Zhang - MSFT Feb 13 '23 at 08:20
  • Hello. I scrapped the old project and went forward with Blazor Hybrid as I also have a blazor website. The app worked and had about 3 releases to the play store, but today, the ugly problem rears its head again in Blazor Hybrid. Working in debug but not in release. What on earth is going on with .NET MAUI? – Tanaka Mawere Mar 13 '23 at 11:29

1 Answers1

0

I have also had the problem. The app crashed on me because in my xaml code the reference to a control was wrong!

By that I mean:

Failed:

 <toolkit:IconTintColorBehavior TintColor="{Binding BindingContext.SomeProperty, Source={x:Reference WrongReference}}" />

because of the WrongReference. To figuring it out has cost me time and effort! Just check all your x:References in the files you extended!

Note: The 'Output' window gave me a hint about this because this subsequent binding could not resolve. After correcting the issue the app should not crash anymore!

Stefano
  • 1
  • 1