1
votes

I am trying to build Xamarin Forms Android App but it's not getting compiled in Release mode, while Debug works fine.

Error Detail:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(5,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly. Mono.Linker.Steps.XmlResolutionException: Failed to process XML description: ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Prism.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Prism.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x0015e] in /Users/builder/data/lanes/6102/8255f42f/source/monodroid/external/xamarin-android/external/mono/external/cecil/Mono.Cecil/BaseAssemblyResolver.cs:172 at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x0005c] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00007] in <947dd92f52fa43c1922f96c7b9774bdc>:0 --- End of inner exception stack trace --- at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00030] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at Mono.Linker.Steps.ResolveFromXmlStep.GetAssembly (Mono.Linker.LinkContext context, Mono.Cecil.AssemblyNameReference assemblyName) [0x00000] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at Mono.Linker.Steps.ResolveFromXmlStep.ProcessAssemblies (Mono.Linker.LinkContext context, System.Xml.XPath.XPathNodeIterator iterator) [0x00010] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at Mono.Linker.Steps.ResolveFromXmlStep.Process () [0x00037] in <947dd92f52fa43c1922f96c7b9774bdc>:0 --- End of inner exception stack trace --- at Mono.Linker.Steps.ResolveFromXmlStep.Process () [0x000a9] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at Mono.Linker.Steps.BaseStep.Process (Mono.Linker.LinkContext context) [0x00010] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0001c] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x00071] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x002d4] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at Xamarin.Android.Tasks.LinkAssemblies.Execute () [0x0021f] in <947dd92f52fa43c1922f96c7b9774bdc>:0 at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573 at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784 (MSB4018) (VSTSBuild.Droid)

Also I noticed that it's building in Release mode as well if I enable 'Use Shared Mono Runtime' but if it's disabled then I am having issue building the solution.

1
Have you added the Prism.Core package to your Xamarin.Android project?SushiHangover
Yes, Prism.Core package is added in Xamarin.Android projectDishant

1 Answers

0
votes

Okay, I found out that issue was with LinkerSettings. Previously my Linker Settings was like this:

<linker>
    <assembly
        fullname="Prism.Core" />
    <assembly
        fullname="Prism.Forms" />
    <assembly
        fullname="Prism.Unity.Forms" />
    <assembly
        fullname="Prism.Plugin.Popups" />
</linker>

Which I updated to:

<linker>
    <assembly
        fullname="Prism.Forms">
        <type
            fullname="Prism.Common.ApplicationProvider"
            preserve="all" />
        <type
            fullname="Prism.Services.PageDialogService"
            preserve="all" />
        <type
            fullname="Prism.Services.DeviceService"
            preserve="all" />
        <type
            fullname="Prism.Ioc*"
            preserve="all" />
        <type
            fullname="Prism.Modularity*"
            preserve="all" />
        <type
            fullname="Prism.Navigation*"
            preserve="all" />
        <type
            fullname="Prism.Behaviors.PageBehaviorFactory"
            preserve="all">
            <method
                name=".ctor" />
        </type>
        <type
            fullname="Prism.Services.DependencyService"
            preserve="all">
            <method
                name=".ctor" />
        </type>
    </assembly>
    <assembly
        fullname="Prism">
        <type
            fullname="Prism.Navigation*"
            preserve="all" />
        <type
            fullname="Prism.Logging.EmptyLogger"
            preserve="all">
            <method
                name=".ctor" />
        </type>
    </assembly>
</linker>

Now App is building fine in Release mode as well.