Xamarin.Forms: Android project Build Error - Missi

2019-02-14 01:47发布

问题:

I'm trying the Xamarin.Forms. I created a Solution named "App2". The Visual Studio automatically created the following projects:

  • App2 (Portable)
  • App2.Droid
  • App2.iOS

When I try to compile the Android Project (App2.Droid), I get the following errors:

Download failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip and put it to the C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3 directory. App2.Droid Reason: One or more errors. App2.Droid
Please install package: 'Xamarin.Android.Support.Design' available in SDK installer. Java library file C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3\embedded\classes.jar doesn't exist. App2.Droid Download failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip and put it to the C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3 directory. App2.Droid Reason: One or more errors. App2.Droid
Please install package: 'Xamarin.Android.Support.Design' available in SDK installer. Android resource directory C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3\embedded./ doesn't exist. App2.Droid

I've already tried to:

  • Download the android_m2repository_r22.zip file and put it on the C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3 folder
  • Download the file and extract it to the folder
  • Delete the C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3 folder and recompile project
  • Delete the C:\Users\pedro.costa\AppData\Local\Xamarin\zips folder and recompile the project.
  • Update the Xamarin.Android.Support.* nuget packages, but when I try it, I also get those build errors.

I've done a lot of research and it seems that the Android.Support.* folders should have files inside it, and that those files should be downloaded when the android solution is built, but it is not happening for me.

回答1:

Try this work around :

  • Navigate to C:\Users\[user-name]\AppData\Local\Xamarin\zips folder.
  • Remove all zip files.
  • Remove /bin and /objfrom your project.
  • Clean and build your project.

It may take a while to build and debug project.



回答2:

1.download https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip

2.rename to 2A3A8A6D6826EF6CC653030E7D695C41.zip

3.copy to C:\Users\User\AppData\Local\Xamarin\zip

4.rebuild



回答3:

I saw in other answers to this problem, that by just deleting all the content from the Android.Support.Design folder, Visual Studio would download it again once the project was rebuild.

The problem in my case, was a proxy issue. When I set my environment to access the internet without the proxy, Visual Studio download the necessary files and folders on the rebuild.



回答4:

Don't extract the zip to \23.0.1.3folder or just put it there, that won't work don't mind the error message. You must put the zip in the \zip folder, after you delete the already existing zip, you may need to rename the zip you downloaded to something like: 2A3A8A6D6826EF6CC653030E7D695C41.zip

But if you don't want to manually download the support repository you can just delete everything in the %USER%\AppData\Local\Xamarin\ folder and rebuild and wait.



回答5:

there is a zips name folder over this address C:\Users\[user-name]\AppData\Local\Xamarin\zips first u have to check it the file is in extract condition there we can see an error it is an currupt format then u can replace those two files 1)2A3A8A6D6826EF6CC653030E7D695C41.zip replace by this link rename with 2A3A8A6D6826EF6CC653030E7D695C41

2)96659D653BDE0FAEDB818170891F2BB0.zip replace by this link rename with 96659D653BDE0FAEDB818170891F2BB0

then rebuild the project