Xamarin Forms build generates multiple errors
I'm trying to get started with Xamarin Forms so I started building a simple application. Everything looks good until I try to build it. After a few minutes, I get several errors that look 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 by different files. I don't think the problem is with my code, but there is always such a possibility. What's not happening and how can I fix it?
source to share
The IDE tries to load Xamarin.Andriod.Support.v4 but fails depending on a network error. Download the zip file from https://dl-ssl.google.com/android/repository/android_m2repository_r15.zip and place it in C: \ Users \ James \ AppData \ Local \ Xamarin \ Android.Support.v4 \ 22.2.0 folder \ Then rebuild the project and you should be fine.
source to share
On Mac, navigate to the folder ~/.local/share/Xamarin/zips
. Perfume the following:
-
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 again ls -lh
, you should be able to see that Xamarin Studio is still downloading files in the background and the zip file continues to grow in size. Give it some time and if the build keeps failing to load the file mentioned in the error. In my case, the link was https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip .
-
Download the file and place it in a folder
~/.local/share/Xamarin/zips
and rename the file according to the name of the hashed zip file. In my case, I deleted0B3F1796C97C707339FB13AE8507AF50.zip
and copied the downloaded file and renamed it to0B3F1796C97C707339FB13AE8507AF50.zip
. Check the time and replace the last one. -
Clean and then rebuild the project
- Everything should work now.
-
If you go to now
~/.local/share/Xamarin/Xamarin.Android.Support.v4
, you will see a new folder with the generated support version, in my case it was23.3.0.0
. and inside they were two folders,content
andembedded
. -
If this still fails, try to create the folder indicated in the error first in
~/.local/share/Xamarin/Xamarin.Android.Support.v4
and then restore again.
source to share