Bug 13212 - MapsAndLocationDemo_v2 - Linking fails to resolve "Android.App.Fragment"
Summary: MapsAndLocationDemo_v2 - Linking fails to resolve "Android.App.Fragment"
Alias: None
Product: Android
Classification: Xamarin
Component: Samples ()
Version: 4.6.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Peter Collins
Depends on:
Reported: 2013-07-12 13:11 UTC by Quincy Mitchell
Modified: 2013-10-03 12:34 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Quincy Mitchell 2013-07-12 13:11:05 UTC

Can you try to build the sample in release with linking on? I wonder if you can reproduce the following build error. I'm trying to use a map in my app, but it gets the same build error as the sample does.

I'm getting this build error: (which i'm only guessing is referring to the MapFragment's inheritance from App.Fragment...)

-Quincy Mitchell

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.d__20.MoveNext() (MSB4018) (SimpleMapDemo_Froyo)
Comment 1 Quincy Mitchell 2013-07-13 16:55:05 UTC
Sorry, figured out it was my fault. Figured out that I had both a "using Android.App;" and a "using Android.Support.V4.App;"

So I removed "using Android.Support.V4.App;" then typed manually the namespace for my activity annotation.

Yippee then it linked.

FYI got it working for FROYO
Comment 2 Alexey Strakh 2013-10-03 12:34:29 UTC
Unfortunately, proposed workaround doesn't work for me.
My project wouldn't compile with "SDK Libs Only" linker option.
Thus I downloaded the sample and played a little with it:

0. Opened SimpleMapDemo_Froyo project
1. Changed Activity name to Android.Support.V4.App.FragmentActivity 
2. Removed using statement.
3. Repeat for every fragment activity in the Project.

Same linker error:
MSB4018: The "LinkAssemblies" task failed unexpectedly.
Mono.Cecil.ResolutionException: Failed to resolve Android.App.Fragment

See screenshot

The only solution here is to disable linker by specifying "None" option.
In this case APK size is dramatically increased from 7 MB to 30 MB. It doesn't work in my case.

Please fix it or propose workaround.