Xamarin.Android linking fails with TargetFramework 7.0
See original GitHub issueAs some people have mentioned in #439, the linking of Xamarin.Android fails with the following error message when using the hosted agent:
2016-12-04T16:39:27.4138913Z "C:\a\1\s\Droid\TestApp.Droid.csproj" (Clean;clean;PackageForAndroid target) (1) ->
2016-12-04T16:39:27.4138913Z (_LinkAssembliesShrink target) ->
2016-12-04T16:39:27.4148783Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly. [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4158787Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'System.IO.MonoIOError' (defined in 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e') from 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve System.IO.MonoIOError [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4158787Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference) [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4158787Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference) [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4158787Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4158787Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4158787Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue() [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4158787Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process() [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4168781Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context) [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4168781Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4228774Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute() [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4228774Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: --- End of inner exception stack trace --- [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4228774Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args) [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4228774Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute() [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4228774Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\a\1\s\Droid\TestApp.Droid.csproj]
2016-12-04T16:39:27.4228774Z C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [C:\a\1\s\Droid\TestApp.Droid.csproj]
I set the linker behaviour to SdkOnly
. If I disable linking completely the build succeeds but obviously the APK file gets much bigger.
I’ve currently set the target framework to use the latest installed platform, which causes it to use v7.0. This can I also confirm by the logs. As you can see in #439, it’s working for @InquisitorJax and @msimecek if they switch the target framework to version v6.0. I also tried setting the TargetFrameworkVersion to v6.0 and can confirm that it works correctly.
I created a test repo for you to test and confirm the issue. It has a master branch that has it’s TargetFrameworkVersion set to v7.0 and another branch named AndroidM that has it’s TargetFrameworkVersion set to v6.0
https://github.com/fela98/android-n-vsts-test
Here the settings of the Xamarin.Android build task that I use:
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
Hi @madhurig, is there any more detailed ETA when the Android SDK version will be updated?
@jerone : Thanks for confirming.