dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.15k stars 1.74k forks source link

Android App Fails in Release Build on Android 14 #19027

Closed david-maw closed 11 months ago

david-maw commented 11 months ago

Description

I have an App migrated from Xamarin that works fine in debug builds on Android levels including 14. Release builds work on levels 13 and below but fail when run on Android 14. A workaround is to build targeting Android 13, which generates warnings but produces a file which will run on Android 14.

I don't know much about Android programming but looking at logcat for a failed run I see a stack dump for: java.lang.SecurityException: com.autoplus.divisibill: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts Since it's not visible in the run that works this seems like some sort of tighter security requirement might be the problem. I've attached logs for a working and failing run.

failed.txt worked.txt

I've no idea what make my app require this permission but the NuGet packages it uses are:

   <ItemGroup>
      <PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
      <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
      <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
      <PackageReference Include="CommunityToolkit.Common" Version="8.2.2" />
      <PackageReference Include="CommunityToolkit.Maui" Version="7.0.0" />
      <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
      <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.3" />
      <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.3" />
      <PackageReference Include="Plugin.InAppBilling" Version="7.1.0" />
      <PackageReference Include="SixLabors.ImageSharp" Version="3.0.2" />
      <PackageReference Include="SkiaSharp" Version="2.88.6" />
      <PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" />
   </ItemGroup>

Steps to Reproduce

I cannot reproduce this in a simple test case

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 14

Did you find any workaround?

Yes, build the project targeting Android 13 - it will then run on Android 14. You'll have to change the target in the android manifest (see issue #19024)

Relevant log output

No response

drasticactions commented 11 months ago

It's most likely this: https://github.com/dotnet/maui/issues/17861

Which is fixed in main and should appear in the next net8.0 Service Release.

e. And before you ask, I don't know when that is, if anyone on the MAUI team knows feel free to say.

david-maw commented 11 months ago

Sure looks like it, Thanks.

jfversluis commented 11 months ago

Duplicate of #17861