Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Forms Android Error: Please install package 'Android Support Library'

I recently uploaded my project to Git, and used a auto-generated Xamarin/Windows/MacOS/VisualStudio .gitignore file. I did a lot of work and testing on iOS, but now I'm coming back to android but upon building the Project.Droid version, I get the following errors:

Error   11  Please install package: 'Android Support Library' available in SDK installer. Android resource directory C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\embedded\./ doesn't exist.    MyProject.Droid
Error   5   Please install package: 'Android Support Library' available in SDK installer. Java library file C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\embedded\classes.jar doesn't exist.    MyProject.Droid
Error   8   Please install package: 'Android Support Library' available in SDK installer. Java library file C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\embedded\libs/internal_impl-21.0.3.jar doesn't exist.  MyProject.Droid
Error   4   Reason: C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\android_m2repository_r10.zip is not a valid zip file   MyProject.Droid
Error   7   Reason: C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\android_m2repository_r10.zip is not a valid zip file   MyProject.Droid
Error   10  Reason: C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\android_m2repository_r10.zip is not a valid zip file   MyProject.Droid
Error   3   Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r10.zip and extract it to the C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\content directory.   MyProject.Droid
Error   6   Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r10.zip and extract it to the C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\content directory.   MyProject.Droid
Error   9   Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r10.zip and extract it to the C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\content directory.   MyProject.Droid

Does anyone know how can I fix it? I checked my SDK Manager using admin rights and I already have the Android Support Library installed

like image 272
sgarcia.dev Avatar asked May 25 '15 17:05

sgarcia.dev


4 Answers

The error message tells you pretty explicitly

  1. what the error is

    C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\android_m2repository_r10.zip is not a valid zip file

  2. How to fix it

    Please download https://dl-ssl.google.com/android/repository/android_m2repository_r10.zip and extract it to the C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\content directory.

like image 97
Jason Avatar answered Oct 27 '22 22:10

Jason


I'm just posting the Mohamed Elrashid's comment as an answer Because I think this is the best solution. Because it is in a comment and most of the people do not try this first.

You can DELETE everything in Corresponding the folder C:\Users\dev\AppData\Local\Xamarin\Android.Support.v4\21.0.3\ and Xamarin will automatically download again

It is valid for 22.2.1 version too, so I think it is a general solution of every version(guess)

EDIT => Please follow the ans by Jason that always works.

Suggestion: all these kind off error has a link for the zip to download and where to save it to fix. So for all other zip files follow the same ans.

like image 28
loop Avatar answered Oct 27 '22 22:10

loop


It looks like the zip can get corrupted (I think I might have killed VS as I hadn't realised it was downloading a >100MB file).

If that's the case, just clear out the zip cache: C:\Users\dev\AppData\Local\Xamarin\zips and they'll all be re-downloaded.

like image 29
JamesDill Avatar answered Oct 28 '22 00:10

JamesDill


This problem usually occurs because of failing to download or install m2repository file.

You can try one of these three options:

1- You can let VS solves the problem it self. It can be done just by deleting (...\AppData\Local\Xamarin\Android.Support.v4) directory and then rebuild the project. VS will download and install what it needs. If it does't work, go to number 2.

2- Manually Downloading android_m2repository_rnn.zip and putting it into (...\AppData\Local\Xamarin\zips ) folder. VS will do the rest (including extracting and installing the file). You can download m2repositories from here:

https://dl-ssl.google.com/android/repository/android_m2repository_r33.zip

Just rename the number at the end of URL to what you need and then download the file.

Note: In some cases you might need to rename the file into it's MD5 hash of URL. (for me VS was a little stupid and doesn't do anything unless I renamed the m2repository file to it's MD5 hash).

Here is a list of some of MD5 hashes:

android_m2repository_r33.zip --> 5FB756A25962361D17BBE99C3B3FCC44.zip android_m2repository_r32.zip --> F16A3455987DBAE5783F058F19F7FCDF.zip android_m2repository_r31.zip --> 99A8907CE2324316E754A95E4C2D786E.zip android_m2repository_r30.zip --> 05AD180B8BDC7C21D6BCB94DDE7F2C8F.zip android_m2repository_r29.zip --> 2A3A8A6D6826EF6CC653030E7D695C41.zip android_m2repository_r28.zip --> 17BE247580748F1EDB72E9F374AA0223.zip android_m2repository_r27.zip --> C9FD4FCD69D7D12B1D9DF076B7BE4E1C.zip android_m2repository_r26.zip --> 8157FC1C311BB36420C1D8992AF54A4D.zip android_m2repository_r25.zip --> 0B3F1796C97C707339FB13AE8507AF50.zip android_m2repository_r24.zip --> 8E3C9EC713781EDFE1EFBC5974136BEA.zip android_m2repository_r23.zip --> D5BB66B3640FD9B9C6362C9DB5AB0FE7.zip android_m2repository_r22.zip --> 96659D653BDE0FAEDB818170891F2BB0.zip android_m2repository_r21.zip --> CD3223F2EFE068A26682B9E9C4B6FBB5.zip android_m2repository_r20.zip --> 650E58DF02DB1A832386FA4A2DE46B1A.zip android_m2repository_r19.zip --> 263B062D6EFAA8AEE39E9460B8A5851A.zip android_m2repository_r18.zip --> 25947AD38DCB4865ABEB61522FAFDA0E.zip android_m2repository_r17.zip --> 49054774F44AE5F35A6BA9D3C117EFD8.zip android_m2repository_r16.zip --> 0595E577D19D31708195A83087881EE6.zip

You can also find the list here: https://developer.xamarin.com/guides/android/troubleshooting/resolving-library-installation-errors/#Manually_Downloading_m2repository

3- Manually Downloading and Installing m2repository Files. The detailed process can be found here:

https://developer.xamarin.com/guides/android/troubleshooting/resolving-library-installation-errors/#Manually_Downloading_and_Installing_m2repository_Files

like image 41
Milad Faridnia Avatar answered Oct 27 '22 22:10

Milad Faridnia