1. 程式人生 > >Xamarin介紹和Windows環境搭建

Xamarin介紹和Windows環境搭建

一,Mono介紹

1,What is Mono

        Novell公司開發的跨平臺·NET執行環境,mono是指由Novell公司(由Ximian發起,並由Miguel de lcaza領導的,一個致力於開創·NET在Linux上使用的開源工程。Mono的C #編譯器及其相關工具釋出於GNU General Public License (GPL)之下,其執行時庫釋出於GNU Lesser General Public License (LGPL)之下,其類庫釋出於MIT License之下.這些均是開源協議因此Mono是一個開源軟體.

2,What is Xamarin

        Xamarin始創於2011年,旨在使移動開發變得難以置信地迅捷和簡單。Xamarin的產品簡化了針對多種平臺的應用開發,包括

iOSAndroidWindows PhoneMac App。Xamarin由許多著名的開源社群開發者創立和參與,而且也是Mono專案的主導者——C#與·NET框架的開源、跨平臺實現。

        Xamarin現在已經形成了一個完整的體系,目前有Xamarin Studio、Xamarin.Forms、Xamarin for Visual Studio、Xamarin Test Cloud,以及包含前面四個工具的Xamarin Platform。它的目標是 用C#開發iOS、Android和Windows Phone原生應用程式,一次開發,多平臺交付。

        Xamarin Studio是一個用C#語言開發跨平臺應用的整合開發環境,它和iOS以及Android SDK緊密整合。Xamarin Studio提供了很多現代開發所需功能,包括程式碼完成、偵錯程式、打包和釋出應用(支援通過TestFlight釋出應用程式)。對於Android,Xamarin還包含了自己的UI生成器(對於iOS,則使用蘋果Xcode的UI生成器),此外還集成了Git和Subversion。開發者可以使用Xamarin Studio在模擬器和真機上對移動應用進行測試和bug除錯。Xamarin Studio能夠完美支援Windows和Mac。

        Xamarin還提供了for vs2010 vs2012的外掛,這個是比較吸引人的地方。該外掛可以很好地與微軟的生態系統整合,可以在Mac OS機器的模擬器上進行遠端除錯和測試。在Mac OS上,因為iOS的現有限制,面向iOS的C#程式碼會通過AOT編譯技術直接編譯為ARM彙編程式碼。而在Android上,應用程式會轉換為IL,啟動時再進行JIT編譯。

二,Xamarin installed in Windows

2.0 環境配置以及效果圖

    2.0.1  安裝環境:

        win7  旗艦版 64位、VS2010 。

    2.0.2  效果圖:

        安裝完成後 Xamarin Studio IDT開發工具介面

           

2.1 自動安裝

    從Xamarin官網下載 http://xamarin.com/download 安裝包檔案 XamarinInstaller.exe,雙擊執行靜默安裝。

2.2 手動安裝

  2.2.1  下載需求

     附Android SDK開發包國內下載地址:

  2.2.2 安裝步驟

    1.2,安裝JDK:jdk-7u45-windows-x64.exe

        1.2.1 到oracle官方下載 jdk-7u45-windows-x64.exe。

        1.2.2 配置JAVA環境變數。JAVA_HOME:C:\Program Files (x86)\Java\jdk1.7.0_71,新增環境變數CLASSPATH:%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar。修改環境變數Path:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;

    1.3,安裝Android SDK:

        1.3.1 到developer.android.com 網站 下載installer_r24.0.2-windows.exe 

        1.3.2 配置環境變數。Android SDK 環境變數。修改環境變數 PATH:D:\eclipse\adt-bundle-windows-x86_64-20140702\sdk\tools

    1.4,安裝Xamarin Studio

    1.5,安裝NDK

    1.6,安裝GTK

    1.7,安裝Xamarin for Visual Studio

2.3 提示檔案資訊如下:

    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 7
Android API 8
Android API 10
Android API 12
Android API 14

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 r8d 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.25 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.7.1 installer to any directory on your disk, double-click it and follow the on-screen instructions.

Xamarin
Download the Xamarin v3.9.289 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.