Xamarin Forms Android Error: Please install packag

2019-01-09 01:18发布

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

13条回答
够拽才男人
2楼-- · 2019-01-09 01:34

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.

查看更多
Animai°情兽
3楼-- · 2019-01-09 01:36

If you are from Iran or other countries which are blocked by google, you will get these kinda errors because Xamarin can't dl the packages from google. in that case Please try deleting the zips folder, and any Android.Support.* folders from inside C:\Users\username\AppData\Local\Xamarin then try rebuild the android project after connecting to a VPN like https://www.betternet.co/.

查看更多
The star\"
4楼-- · 2019-01-09 01:38

I went through the same problem and I have just fixed using the following steps:

  • Delete the *.zip files from the folder:

C:\Users\YOUR_USER\AppData\Local\Xamarin\zips\

  • Delete the folders starting with "Xamarin.Android.*":

C:\Users\YOUR_USER\AppData\Local\Xamarin\Xamarin.Android.*

  • Navigate to the directory of your solution and delete all the "bin" and "obj" folders

  • Make sure you have the latest Java SDK. In my case the latest one is JDK 1.8:

C:\Program Files\Java\jdk1.8.0_111

  • In my case I didn't have the latest java SDK so I searched in google for "Java SE Development Kit Downloads". It took me to the Oracle website page about "Java SE Development Kit 8 Downloads". I downloaded the file "jdk-8u111-windows-x64.exe" (194.64 MB). After the installation it created a folder "C:\Program Files\Java\jdk*\".

  • Make sure your Xamarin is pointing to this JDK:

In the Visual Studio go to "Tools -> Options -> Xamarin -> Android Settings -> Java Development Kit". In my case I set it to "C:\Program Files\Java\jdk1.8.0_111"

  • Now you should right click in your solution and "Clear solution" and after that you should "Rebuild Solution"

I hope it helps.

查看更多
相关推荐>>
5楼-- · 2019-01-09 01:38

1: Download "https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip" into your (mediafire.com or other upload center websites)

2: Download "android_m2repository_r22.zip" from your mediafire panel into your computer

3: Rebuild your solution to get list of error codes

4: Find error(Error Reason: "C:\Users\Vahid\AppData\Local\Xamarin\zips\96659D653BDE0FAEDB818170891F2BB0.zip" is not a valid zip file)

5: Copy your android_m2repository_r22.zip into "C:\Users\Vahid\AppData\Local\Xamarin\zips\" directory

6: Rename "android_m2repository_r22.zip" to "96659D653BDE0FAEDB818170891F2BB0.zip"

7: Rebuild your solution

8: Enjoy xamarin form.

List of md5 name for your download file are available in "https://developer.xamarin.com/guides/android/troubleshooting/resolving-library-installation-errors/#Manually_Downloading_m2repository"

查看更多
forever°为你锁心
6楼-- · 2019-01-09 01:41

Delete all foldeC:\Users[username]\AppData\Local\Xamarin. And then rebuild your project.

Hope this help

查看更多
smile是对你的礼貌
7楼-- · 2019-01-09 01:42

Sometimes Android Studio will not download package because of network issues.

Here the solution for that.

Download zip package directly from https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip

Delete existing package zip from C:\Users\josec\AppData\Local\Xamarin\zips and Put the downloaded package zip into it.

查看更多
登录 后发表回答