James Parsons
James Parsons

Reputation: 6047

Xamarin Forms build generates several errors

I am trying to get started with Xamarin Forms, so I started creating a simple app. Everything looks fine, until I attempt to build it. After few minutes I get several errors looking like this:

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error XA5209: Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r15.zip and extract it to the C:\Users\James\AppData\Local\Xamarin\Android.Support.v4\22.2.0\content directory. (XA5209) (App.Droid)

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error XA5209: Reason: C:\Users\James\AppData\Local\Xamarin\Android.Support.v4\22.2.0\android_m2repository_r15.zip is not a valid zip file (XA5209) (App.Droid)

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error XA5207: Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. Java library file C:\Users\James\AppData\Local\Xamarin\Android.Support.v4\22.2.0\embedded\classes.jar doesn't exist. (XA5207) (App.Droid)

This error is replicated several times with different files. I do not believe that the issue is with my code, but there always is that possibility. What is going no and how do I fix it?

Upvotes: 3

Views: 3964

Answers (3)

Joseph
Joseph

Reputation: 6031

On a Mac, go to the folder ~/.local/share/Xamarin/zips. Perfom the following :

  1. ls -lh . You will see something like this

197M Oct 10 08:19 2A3A8A6D6826EF6CC653030E7D695C41.zip 116M Oct 5 14:55 0B3F1796C97C707339FB13AE8507AF50.zip

If you run ls -lh again, you might be able to see that Xamarin Studio is still downloading the files in the background and the zip file size keeps growing. Give it some time and if the build continues failing download the file mentioned in the error. In my case the link was https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip.

  1. Download the file and place it in the ~/.local/share/Xamarin/zips folder and rename the file to match one of the hashed zip file name. In my case i removed the 0B3F1796C97C707339FB13AE8507AF50.zip and copied the downloaded file and renamed it to 0B3F1796C97C707339FB13AE8507AF50.zip. Check the time and replace the latest one.

  2. Clean and then rebuild the project

  3. Everything should now work
  4. If you now navigate to ~/.local/share/Xamarin/Xamarin.Android.Support.v4 you should see a new folder with the support version created, in my case it was 23.3.0.0. and inside they were two folders, content, and embedded.

  5. If this still fails, try create the folder mentioned in the error first in ~/.local/share/Xamarin/Xamarin.Android.Support.v4 and then rebuild again.

Upvotes: 0

bomaboom
bomaboom

Reputation: 300

The IDE tries to download the Xamarin.Andriod.Support.v4 but fails depending on network error. Download the zip file from https://dl-ssl.google.com/android/repository/android_m2repository_r15.zip and put it in C:\Users\James\AppData\Local\Xamarin\Android.Support.v4\22.2.0\ Then rebuild the project and you should be good.

Upvotes: 6

Will Decker
Will Decker

Reputation: 3266

As Jason mentioned, based on the output it would appear that you are missing some required files. I would suggest opening the Android SDK Manager and updating all of the available items as well as ensuring you have the latest version of Xamarin.Android

Upvotes: 2

Related Questions