Visual Studio Xamarin编译Android项目出错的解决办法

安装完Xamarin后,编译Android项目时,你会发现好长时间进度都不动,当你取消编译后,会发现其实是出错了,就是因在Android项目在第一次编译时要去google网站上下一个andorid sdk包,墙内又连不上,就卡在那了,解决办法就是自已到国内的一些镜像网站上(如:http://mirrors.opencas.cn/android/)下一个,如:android_m2repository_r29.zip, 然后解压到任意目录下,用mklink建立链接到C:Users{username}AppDataLocalXamarinAndroid.Support.v423.3.0.0目录下,名字叫content,如命今:

cd Android.Support.Animated.Vector.Drawable23.3.0.0
rmdir content
mklink /j content ....android_m2repository_r29
cd ....

cd Android.Support.Design23.3.0.0
rmdir content
mklink /j content ....android_m2repository_r29
cd ....

cd Android.Support.v423.3.0.0
rmdir content
mklink /j content ....android_m2repository_r29
cd ....

cd Android.Support.v7.AppCompat23.3.0.0
rmdir content
mklink /j content ....android_m2repository_r29
cd ....

cd Android.Support.v7.CardView23.3.0.0
rmdir content
mklink /j content ....android_m2repository_r29
cd ....

cd Android.Support.v7.MediaRouter23.3.0.0
rmdir content
mklink /j content ....android_m2repository_r29
cd ....

cd Android.Support.v7.RecyclerView23.3.0.0
rmdir content
mklink /j content ....android_m2repository_r29
cd ....

cd Android.Support.Vector.Drawable23.3.0.0
rmdir content
mklink /j content ....android_m2repository_r29
cd ....

cd Android.Support.Animated.Vector.Drawable23.3.0.0
rmdir content
mklink /j content ....android_m2repository_r29
cd ....

这样再回到VS中编译,就OK了。

原文地址:https://www.cnblogs.com/zhongzf/p/5447592.html