Home » Android » Building Android Xamarin.Forms app using Azure DevOps takes more than an hour-Exceptionshub

Building Android Xamarin.Forms app using Azure DevOps takes more than an hour-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

My Android app pipeline for building an Xamarin.Forms app in Azure DevOps takes more than an hour to finish, resulting in Azure DevOps aborting the build. I have tried to figure out what changed, but never found the cause. The logfiles don’t give me much to work on even when building in /verbosity:detailed mode. Can anyone help us diagnose where the problem is?

The iOS app builds without problems by the way.

The logfile always looks like this when it takes forever to finish:

Target “_ResolveAssemblies” skipped. Previously built successfully.
Target “_CreatePackageWorkspace” skipped. Previously built
successfully. Target “_GenerateJniMarshalMethods” skipped, due to
false condition; (‘$(AndroidGenerateJniMarshalMethods)’ == ‘True’ And
‘$(AndroidLinkMode)’ != ‘None’ And ‘$(OS)’ != ‘Windows_NT’) was
evaluated as (‘False’ == ‘True’ And ‘SdkOnly’ != ‘None’ And ‘Unix’ !=
‘Windows_NT’). Target “_LinkAssembliesNoShrink” skipped, due to false
condition; (‘$(AndroidLinkMode)’ == ‘None’) was evaluated as
(‘SdkOnly’ == ‘None’). Target “_LinkAssembliesShrink” in file
“/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets”
from project
“/Users/runner/runners/2.164.8/work/10/s/Kibba.Android/Kibba.Android.csproj”
(target “_LinkAssemblies” depends on it): Building target
“_LinkAssembliesShrink” completely. Output file
“obj/Release/link.flag” does not exist. Task “CreateProperty” skipped,
due to false condition; ( ‘$(AndroidLinkTool)’ != ” ) was evaluated
as ( ” != ” ). Task “MakeDir” skipped, due to false condition; (
‘$(AndroidLinkTool)’ != ” ) was evaluated as ( ” != ” ). Using
“LinkAssemblies” task from assembly
“/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Build.Tasks.dll”.
Task “LinkAssemblies” Processing resource linker descriptor:
mscorlib.xml Processing resource linker descriptor: Mono.Android.xml
Processing embedded resource linker descriptor: mscorlib.xml
Processing embedded resource linker descriptor:
System.Text.Encodings.Web.xml Duplicate preserve in descriptor
mscorlib.xml from Xamarin.Android.Build.Tasks, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null of System.AppDomain (Nothing).
Duplicate uses (Fields) Duplicate preserve in descriptor
mscorlib.xml from Xamarin.Android.Build.Tasks, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null of System.AppDomainSetup
(Fields). Duplicate uses (Fields) Added method:
Xamarin.Forms.Button
Xamarin.Forms.Platform.Android.IButtonLayoutRenderer::get_Element() to
type: Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer scope:
Xamarin.Forms.Platform.Android.dll Type System.Reflection.Assembly
has no fields to preserve Type Mono.ValueTuple has no fields to
preserve Type System.Reflection.Emit.ByRefType has no fields to
preserve Type System.Reflection.Emit.PointerType has no fields to
preserve

EDIT: It appears this is a bug in Xamarin.Android which is fixed but not released yet. For anyone who experiences the same issue, this is the issue at GitHub: https://github.com/xamarin/xamarin-android/issues/3852

How to&Answers: