Reputation: 2529
Here is th exception I get when i try to run in release mode:
4> C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: The "BuildApk" task failed unexpectedly.
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: System.ArgumentException: An item with the same key has already been added.
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: at Ionic.Zip.ZipFile._InternalAddEntry(ZipEntry ze)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: at Ionic.Zip.ZipFile.AddFile(String fileName, String directoryPathInArchive)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: at Xamarin.Android.Tasks.BuildApk.AddAssemblies(ZipFile apk)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: at Xamarin.Android.Tasks.BuildApk.Execute()
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
Anyone have any suggestions how can I resolve this issue?
Upvotes: 1
Views: 1909
Reputation: 319
I solve this problem with cleaning project. Right-click on Project name -> Clean.
Upvotes: 1
Reputation: 67898
This is happening because it's trying to add two files with the same name to the archive. Check the XML of your project file for the duplicate. As an aside, it's likely that your project is actually displaying a file twice in the explorer and you've dismissed it as a anomaly or bug, so that might be a hint as to which file is the problem.
Upvotes: 0