您的位置:首页 > 移动开发 > Android开发

终于搭建成功Xamarin for Android平台

2015-09-24 00:16 447 查看
终于搭建成功Xamarin for Android平台

历尽波折终于搭建成功Xamarin for Android平台,总结一下。
1.下载运行jdk-7u71-windows-i586.exe 安装 jdk 并设置环境变量
J***A_HOME=C:\Program Files (x86)\Java\jdk1.7.0_71

path+=;%J***A_HOME%\bin;%J***A_HOME%\jre\bin;

CLASSPATH= .;%J***A_HOME%\lib;%J***A_HOME%\lib\tools.jar

很容易就成功了。


2.运行 installer_r22-windows.exe 安装Android SDK Tools,并安装
Android SDK Tools

Android SDK Platform-tools
Android SDK Build-tools
Android API 15
Android API 19
Android API 21

此步至关重要,必须完整安装上述包,由于 Android SDK 默认的安装包不全,所以必须手动完成所有安装,要设置代理服务器(如mirrors.opencas.cn)和端口(如80),并允许将强制https转换为http.要实现快速安装,必须借助于迅雷等下载工具,其实所有的包都可以通过迅雷下载,以安装api15为例,先在Androiandroid
sdk manager log中找到所有包含API15的xml文件的文件地址,如 http://dl.google.com/android/repository/sys-img/android/sys-img.xml等,可能会有5、6个或更多一些,用IE逐个打开,在其中查找15_r,找到包含15_r的zip文件,将文件地址中的最后一个斜线及前的部份与该文件合并为一个新的下载地址备用,所有的下载地址形成(大约需要15分钟)后,统一用迅雷下载,一般20分钟就全部下载好了,再将这些下载好的文件复制到android
sdk文件夹下的temp文件夹,再用Android sdk Manager安装,这样很快就能安装好了。其他的包也一样安装。

3.运行android-ndk-r10d-windows-x86_64.exe

注意要安装于 android sdk文件夹,很容易就成功了。



4.运行 gtk-sharp-2.12.26.exe

很容易就成功了。 如在win 10下则可能需要用msiexec进行安装。方法如下:

1.运行CMD(管理员)

2.输入以下命令: msiexec /i e:\software\xamarin\gtk-sharp-2.12.26.msi

5.XamarinStudio-5.9.3.1-0.exe

很容易就成功了。 如在win 10下则可能需要用msiexec进行安装。 注意安装好后要安装升级包,否则可能会出现无法使用layout designer打开axml文件的问题。


6.运行Xamarin.VisualStudio_3.11.590.exe

很容易就成功了。 如在win 10下则可能需要用msiexec进行安装。


7.XamarinInstaller.exe

最后再安装一遍 XamarinInstaller.exe。很容易就成功了。

大功告成。

建立虚拟机,正常。

在xamarin studio 内建立android应用,正常,试做了一个应用,能部署到自己的手机上。

在Visual Studio 2015内建立android应用,正常。

一点疑惑,按照XamarinInstaller的提示,似乎要安装Java JDK v1.6,但没有安装也没有出现问题,也许今后会出现问题,那时再来安装,提示如下:

It is very important to install the 32-bit version of Java JDK even if you're using 64-bit Windows. It is also important that Java JDK v1.6 is installed (although it is fine to have Java JDK 1.7 or newer installed at the same time)

总结:由于网上没有完整的资料,所以走了不少弯路。也怪自己粗心,如果完全按照Xamarininstaller的提示来进行安装并仔细检查,也许会少走些弯路。完整的提示如下:

It was not possible to complete an automatic installation. This might be due to a problem with your network, proxy servers or an unsolvable installation conflict. At this point, you can continue the installation by manually downloading and installing the independent pieces. The list below shows each component that you need to install.

Java JDK

Download the Java JDK v1.7.0 installer to any directory on your disk, double-click the downloaded file and follow the on-screen instructions.

It is very important to install the 32-bit version of Java JDK even if you're using 64-bit Windows. It is also important that Java JDK v1.6 is installed (although it is fine to have Java JDK 1.7 or newer installed at the same time)

Android SDK

Download the Android SDK for Windows version 22.0.0 to any directory on your disk and double-click it to start main SDK installation process. You can install the SDK either system wide or only for your account. You will need to point your IDE to that location after the installation is completed.

Click here in order to start the Android SDK Manager application. In the GUI make sure the following components are installed or selected for installation:

· Android SDK Tools

· Android SDK Platform-tools

· Android SDK Build-tools

· Android API 15

· Android API 19

· Android API 21

Once all the required components are selected (you can select others as well, if you wish) start the installation. Click here to open target dir

Download the Android NDK for Windows version r10d to any directory on your disk and double-click it to start the NDK installation.

When the Android SDK installation is finished you might want to start the Android Emulator Manager and create as many emulator images as you might need for your development. This step can be performed at any time, on an as-needed basis.

GTK#

Download the GTK# v2.12.26 installer to any directory on your disk, double-click the downloaded file and follow the on-screen instructions.

Xamarin Studio

Download the Xamarin Studio v5.9.3 installer to any directory on your disk, double-click it and follow the on-screen instructions.

Xamarin

Download the Xamarin v3.11.590 installer to any directory on your disk, double-click it and follow the on-screen instructions.

After installation, restart your Windows workstation to make sure all of the installed system services are running.

顺带将API15的安装包的下载地址记录如下:

http://dl.google.com/android/repository/sys-img/google_apis/sysimg_arm-21_r07.zip

http://dl.google.com/android/repository/sys-img/android/sysimg_x86_64-21_r03.zip

http://dl.google.com/android/repository/sys-img/google_apis/sysimg_x86_64-21_r07.zip

http://dl.google.com/android/repository/sys-img/android/sysimg_x86-21_r03.zip

http://dl.google.com/android/repository/sys-img/android-wear/sysimg_wear_x86-21_r03.zip

http://dl.google.com/android/repository/sys-img/android/sysimg_arm-21_r03.zip

http://dl.google.com/android/repository/sys-img/android-wear/sysimg_wear_arm-21_r03.zip

http://dl.google.com/android/repository/sources-21_r01.zip

http://dl.google.com/android/repository/samples-21_r04.zip

http://dl.google.com/android/repository/android-21_r02.zip

http://dl.google.com/android/repository/google_apis-21_r01.zip

http://dl.google.com/android/repository/sys-img/google_apis/sysimg_x86-21_r07.zip

http://dl.google.com/android/repository/sys-img/android-tv/sysimg_atv_x86-21_r03.zip

http://dl.google.com/android/repository/sys-img/android-tv/sysimg_atv_arm-21_r03.zip
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: