Failed to resolve Android.App.fragment with link S

2019-07-20 13:18发布

问题:

I'm getting the following error after adding Google Play Services to my application. I have Link SDK Assms Only enabled and it is critical to keep it enabled.

Sample here: https://dl.dropboxusercontent.com/u/19503836/so_googlemaptest.droid.zip

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(5,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly.
Mono.Cecil.ResolutionException: Failed to resolve Android.App.Fragment
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
   at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.Initialize()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() (MSB4018) (googlemaptest.droid)

How could I do to help linker to resolve Fragment?

回答1:

It is GooglePlayServicesFroyo issue and fix is available in the Xamarin Component store from Oct 19th. MapFragment type is no longer present! You can use GooglePlayServicesFroyo 12.0.1 component right from Xamarin component store and it works fine with SDK Only linker option.

I was able to submit version with linker enabled to Google Play.

Here is Xamarin forum discussion: http://forums.xamarin.com/discussion/8428/google-play-services-froyo-xamarin-component-doesn-t-work-in-release-mode/p2