“ ConvertResourcesCases”任务意外失败。 Xamarin Android构建

时间:2019-02-14 14:56:42

标签: android xamarin xamarin.android mono visual-studio-mac

当我使用Visual Studio 2017 for Mac(7.7.4 build 1)构建Xamarin Android应用程序时,Mono JIT编译器版本5.18.0.248(2018-08 / a4956c837e1 Fri Jan 25 16:13:12 EST 2019)我得到了下列例外情况:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: System.IO.IOException: Could not create file "/Users/username/Companymobil/src/Company.Recipes.Droid/obj/Debug/lp/35/jl/res/values-ca/values-ca.xml" or "/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/tmp565e9644.tmp". File already exists.
/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (Microsoft.Build.Framework.ITaskItem item, System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x00204] in <78f051a6e2064f849cc3ee585300af39>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x0000f] in <78f051a6e2064f849cc3ee585300af39>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Xamarin.Android.Tasks.ConvertResourcesCases.Execute () [0x000a7] in <78f051a6e2064f849cc3ee585300af39>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018: System.IO.IOException: Could not create file "/Users/username/Companymobil/src/Company.ServerAnnouncement.Droid/obj/Debug/lp/15/jl/res/layout/notification_template_icon_group.xml" or "/var/folders/b5/821mhz8n0px17rnxglrjq5mc0000gp/T/tmp4d4475a7.tmp". File already exists.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (Microsoft.Build.Framework.ITaskItem item, System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x00204] in <78f051a6e2064f849cc3ee585300af39>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources (System.Collections.Generic.Dictionary`2[TKey,TValue] acwMap) [0x0000f] in <78f051a6e2064f849cc3ee585300af39>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Xamarin.Android.Tasks.ConvertResourcesCases.Execute () [0x000a7] in <78f051a6e2064f849cc3ee585300af39>:0 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1689,2): error MSB4018:   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784 

如果我单击“构建”(“不重建”),则每次构建时这些异常都会减少,直到最终成功构建为止。

如果我使用jetbrains Rider,则每次都可以进行构建。

我对异常中提到的目录中的每个人都授予了完全权限(r / w),但仍然出现错误。我使用不区分大小写的APFS。

我非常感谢能解决这个问题的任何指针。

1 个答案:

答案 0 :(得分:2)

非常感谢Microsoft的Leon Lu向我指出了正确的方向。该错误源于并行构建xamarin android中的情​​况。禁用并行构建时,每次的结果都是相同的。可以在Mac的Visual Studio 2017的“首选项”中禁用并行构建(请参见附图)。enter image description here

该问题似乎已解决(请参见Leon Lu评论中的GitHub链接),并将在未来的更新之一中推广。