0

After updating Prism NuGet package 7.2.0.1367 to my Xamarin.Forms project, Azure pipelines fails to build. The local build succeeds as does App Center build.

I'm getting the following error in Azure Pipelines:

"/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2053,5): error MSB4018: Mono.Linker.MarkException: Error processing method: 'System.Void Prism.Navigation.PageNavigationService::ConfigureTabbedPage(Xamarin.Forms.TabbedPage,System.String)' in assembly: 'Prism.Forms.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.String[] System.String::Split(System.Char,System.StringSplitOptions) [/Users/vsts/agent/2.155.1/work/1/s/MasterDetailTabbed/MasterDetailTabbed.Android/MasterDetailTabbed.Android.csproj]"

PackageReference:

<ItemGroup>
  <PackageReference Include="Prism.Unity.Forms" Version="7.2.0.1367" />
  <PackageReference Include="Xamarin.Forms" Version="4.1.0.673156" />
  <PackageReference Include="Xamarin.Essentials" Version="1.2.0" />
</ItemGroup>

You can find a sample project regarding this issue on GitHub. It will demonstrate MasterDetailPage navigation in combination with TabbedPages.

I'm kind of lost here, so any help would be appreciated.

Mengdi Liang
  • 17,577
  • 2
  • 28
  • 35
Sw1ma
  • 1
  • 4
  • can you show your android csproj file ? – Roubachof Aug 14 '19 at 11:33
  • @Roubachof, you can find it [here](https://github.com/Sw1ma/prism-samples/blob/master/MasterDetailTabbed/MasterDetailTabbed.Android/MasterDetailTabbed.Android.csproj) as part of the sample project. Thanks for your quick response. – Sw1ma Aug 14 '19 at 11:47
  • try disable AndroidUseAapt2 – Roubachof Aug 14 '19 at 12:30
  • Also, it already happened to me when I forgot to update the Xamarin sdk version (example Xamarin.Android 9.3 is the latest). If prism was built with the latest version and sdk is not up to date in azure it could result in this kind of error. – Roubachof Aug 14 '19 at 12:36
  • Unfortunately, playing arround with AndroidUseAapt2 or AndroidLinkMode didn't do the trick. Probably Azure isn't up-to-date? How could I easily determine which SDK version Prism uses or get an update on Azure :)? – Sw1ma Aug 14 '19 at 14:29
  • You cannot know which against which SDK prism has been compiled. And unfortunately I never used Azure Pipelines. But there must be a way to specify Xamarin Android SDK version in it: this is your quest – Roubachof Aug 14 '19 at 14:39
  • @Roubachof, thanks for pointing me in the right direction, I resolved my issue. – Sw1ma Aug 14 '19 at 20:44

1 Answers1

0

Setting the buid configuration to Debug solved the build problem.

variables:
  buildConfiguration: 'Debug'

...

steps:
- task: XamarinAndroid@1
  inputs:
    projectFile: '**/*droid*.csproj'
    outputDirectory: '$(outputDirectory)'
    configuration: '$(buildConfiguration)'

Probably the Debug build configuration is setting the AndroidLinkMode to None. I didn't properly investigated it but it is most likely, see Linking on Android for more information.

A next step could be Preserving Code.

Sw1ma
  • 1
  • 4