The "XamarinBuildAndroidAarProguardConfigs" task failed unexpectedly

Viewed 1345

I am trying to implement firebase with xamarin.android but after downloading some nugat packages I started getting different errors and the latest one is as below:

Severity    Code    Description Project File    Line    Suppression State
Error       The "XamarinBuildAndroidAarProguardConfigs" task failed unexpectedly.
System.IO.InvalidDataException: Central Directory corrupt. ---> System.IO.IOException: An attempt was made to move the file pointer before the beginning of the file.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.SeekCore(Int64 offset, SeekOrigin origin)
   at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)
   at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory()
   --- End of inner exception stack trace ---
   at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory()
   at System.IO.Compression.ZipArchive.Init(Stream stream, ZipArchiveMode mode, Boolean leaveOpen)
   at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding)
   at Xamarin.Build.Download.XamarinBuildAndroidAarProguardConfigs.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() FireBaseSolution            

android target framework : 25
Some of installed references :

Xamarin.Android.Support.v4
Xamarin.Android.Support.v7.AppCompat
Xamarin.GooglePlayServices.Base
Xamarin.Firebase.Messaging

Please guide me how to resolve it. Thanks

3 Answers

Answering on an old question, but this may help others if they ended up in the same situation as me (not being allowed to modify the version of Xamarin.Build.Download), here's how I fixed it: I deleted the folders for C:\Users(username)\AppData\Local\Xamarin and C:\Users(username)\AppData\Local\XamarinBuildDownloadCache and rebuilt my solution.

What I found was that evening using the NuGet cache clearing tool in Visual Studio, these directories remained untouched. I can only surmise that this issue can also be caused by file corruption (I might have had a faulty network connection), and the DownloadCahe blocked attempting to get the "clean" files.

On MacOS I had to wipe all folders concerning Xamarin in "~/Library/Caches". Afterwards it would build fine.

Related