question

MarcoSalvatori-5288 avatar image
0 Votes"
MarcoSalvatori-5288 asked MarcoSalvatori-5288 answered

error Xamarin forms release mode Android

I have a project. On debug mode work well. When i compile in release mode i have this error:

Gravità Codice Descrizione Progetto File Riga Stato eliminazione
Errore Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Non è stato possibile risolvere il riferimento a 'Android.Support.V4.App.NotificationCompat/BuilderExtender' (definito nell'assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') con ambito 'Xamarin.Android.Support.Compat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Quando l'ambito è diverso dall'assembly che lo definisce, in genere significa che il tipo è stato inoltrato. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Support.V4.App.NotificationCompat/BuilderExtender
in Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
in Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
in MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
in Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
in MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
in Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field)
in Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type)
in Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type)
in Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
in Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
in Mono.Linker.Steps.MarkStep.Initialize()
in Mono.Linker.Steps.MarkStep.Process(LinkContext context)
in MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
in Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
in Mono.Linker.Pipeline.Process(LinkContext context)
in MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
in Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
--- Fine della traccia dello stack dell'eccezione interna ---
in Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
in Xamarin.Android.Tasks.LinkAssemblies.RunTask()
in Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/2/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:riga 17 eTOOLS.Android

What can I do?
Thanks.

dotnet-xamarinforms
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

i found the problem. the onesignal package creates compatibility errors. I tried to insert these lines in the android project.

 <PackageReference Include="Xamarin.Android.Support.Compat" Version="28.0.0.3" />
 <PackageReference Include="Xamarin.Android.Support.Core.UI" Version="28.0.0.3" />
 <PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
 <PackageReference Include="Xamarin.Android.Support.Fragment" Version="28.0.0.3" />
 <PackageReference Include="Xamarin.Android.Support.Media.Compat" Version="28.0.0.3" />

visula studio no longer gives an error but does not generate the release version. in debug everything seems to work fine.

0 Votes 0 ·

Hi, MarcoSalvatori. What behavior do you set for the Link option? The Link All Assemblies option links all assemblies, some code may be removed if there are no static references. Try to set the option to Link SDK Assemblies.

0 Votes 0 ·

I tried several options but nothing ...

0 Votes 0 ·
JarvanZhang-MSFT avatar image JarvanZhang-MSFT MarcoSalvatori-5288 ·

Do you use some third packages in your projecct? Would you mind sharing a screenshot about the release configuration?

0 Votes 0 ·
MarcoSalvatori-5288 avatar image
0 Votes"
MarcoSalvatori-5288 answered

the problem came from the Xamarin.Forms.GoogleMaps package looking for a different compat version ...

the problem seems solved by installing the new 4.0 beta version of Xamarin.Forms.GoogleMaps ...

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MarcoSalvatori-5288 avatar image
0 Votes"
MarcoSalvatori-5288 answered JarvanZhang-MSFT commented

i use several package. thi is the list:
<PackageReference Include="Acr.UserDialogs">
<Version>7.1.0.514</Version>
</PackageReference>
<PackageReference Include="AngleSharp">
<Version>0.16.0</Version>
</PackageReference>
<PackageReference Include="Azure.Storage.Blobs">
<Version>12.9.1</Version>
</PackageReference>
<PackageReference Include="Com.OneSignal">
<Version>3.10.6</Version>
</PackageReference>
<PackageReference Include="HtmlAgilityPack">
<Version>1.11.34</Version>
</PackageReference>
<PackageReference Include="Microsoft.Net.Http">
<Version>2.2.29</Version>
</PackageReference>
<PackageReference Include="NETStandard.Library">
<Version>2.0.3</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="PCLStorage">
<Version>1.0.2</Version>
</PackageReference>
<PackageReference Include="Plugin.AudioRecorder">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Plugin.LocalNotification">
<Version>5.2.0</Version>
</PackageReference>
<PackageReference Include="Plugin.MediaManager">
<Version>1.0.9</Version>
</PackageReference>
<PackageReference Include="Resizetizer.NT">
<Version>0.2.0</Version>
</PackageReference>
<PackageReference Include="Sharpnado.Tabs">
<Version>2.0.1</Version>
</PackageReference>
<PackageReference Include="sqlite-net-pcl">
<Version>1.7.335</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Xamarin.SfImageEditor">
<Version>19.2.0.44</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Xamarin.SfKanban">
<Version>19.2.0.44</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Xamarin.SfPdfViewer">
<Version>19.2.0.44</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.Media">
<Version>5.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.CommunityToolkit">
<Version>1.2.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.FFImageLoading.Forms">
<Version>2.4.11.982</Version>
</PackageReference>
<PackageReference Include="Xamarin.FFImageLoading.Transformations">
<Version>2.4.11.982</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
<PackageReference Include="Xamarin.Forms.GoogleMaps">
<Version>3.3.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms.Visual.Material">
<Version>5.0.0.2012</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Base">
<Version>117.6.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Basement">
<Version>117.6.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Maps">
<Version>117.0.1</Version>
</PackageReference>
<PackageReference Include="YoutubeExplode">
<Version>6.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Compat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Core.UI" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Fragment" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Media.Compat" Version="28.0.0.3" />

the release configuration is:
113045-errore-release-app.png



· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Since Xamarin.Forms 5.0, AndroidX is the default for Android platform. Please use AndroidX.* libraries instead in your project.

0 Votes 0 ·

?!!?
all packages are updated for android X...

0 Votes 0 ·
JarvanZhang-MSFT avatar image JarvanZhang-MSFT MarcoSalvatori-5288 ·

You mentioned that the onesignal package creates compatibility errors, will this issue be solved if removing the onesignal in release? If so, that seems to be an issue with the nuget and you could report it to the author of the package to seek if there's any workaround to get rid of this.

1 Vote 1 ·
MarcoSalvatori-5288 avatar image
0 Votes"
MarcoSalvatori-5288 answered

all correct.
I already made the bug report 10 days ago but I have not received a reply ...

https://github.com/OneSignal/OneSignal-Xamarin-SDK/issues/239


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.