Visual Studio for Mac 安裝

有一週時間沒有更新博客了,最近這段時間真是苦不堪言,上週四晚上,一杯水將我的MBP報廢掉了,開機狀態,鍵盤進水,當場就關機了,很擔心當時爆炸了,幸好還只是關機,然後就。。。沒有然後了。第二天插電源可以開機,不插電源沒法開機,拿到百邦售後服務檢測,結果電源已壞,主辦多處有燒的痕跡,給我報價,總共需要花4300元,我心已崩潰,不知所言,我說算了吧,不修了,修的錢足夠可以買一臺新的電腦。電腦剛買一年,就這樣報廢了,更可憐的是上上週剛換的硬盤,花了1500大洋,真是痛心不已,晚上坐上回山東的高鐵,百邦給我打電話說要回收,中間多次要價,最終報廢電腦以3800塊錢的價格成交,值不值的也就這樣了吧,可是不能沒有本本用啊,當機立斷,看了看轉轉上的新機,挑了一臺價格便宜的,全新未拆的2016款MBP+TouchBar ,13寸+8G+256G,以11000的價格收入囊中,省掉了2888塊錢,也算是可以,賣家是老鄉山東人,也痛快,雖我是一名.Net開發人,但是偏愛蘋果,有點外貌協會,毅然決然的選擇了蘋果,由於是USB-C接口,又買了一個轉接頭,才插上了我的U盤,移動硬盤,雖然做什麼都有點麻煩,但是比起喜歡,這又算得了什麼。

今天的內容是如何安裝VS for Mac,我不知道你們安裝時是否也遇到問題,也不知道是不是我的網太垃圾的問題,想想還是有必要記錄一下吧,不能保證以後會重新裝,因爲我有點強迫症,要想裝什麼東西,都必須要全裝,不管我是不是能用到,看着那一個個的紅色感嘆號我就難受,安裝步驟:

1、首先安裝Visual Studio for Mac Preview Installer(下載地址大家去官網下載就可以了),如圖:


下一步,點擊安裝:

勾選同意繼續安裝,會出來如下界面:


大家可以通過此圖看到安裝發生錯誤,具體文本如下:

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.
Mono Framework
Download the Mono Framework v4.8.0 archive to any directory on your disk, double-click it and follow the instructions on screen. Please accept all the defaults during the installation, including the target drive.

Java SDK
Mac OS X uses its own version of Java and in order to install it you need to start the terminal app and type the following command:
javac -version
After typing it you should see a Mac OS X system popup which will guide you to install the Java software.
Android SDK
Download the Android SDK for Mac OS X version 24.4.1, open the downloaded archive and copy the contents of the folder found at its root directory (most probably named android-sdk-macosx) to the /Users/allen/Library/Developer/Xamarin/android-sdk-macosx directory.

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.
If you cannot see /Users/allen/Library/Developer/Xamarin/android-sdk-macosx in Finder please click here to reveal the directory in Finder.

Download the Android NDK for Mac OS X version r10e, open the downloaded archive and copy the contents of its root directory (most probably named android-ndk-r10e) to the /Users/allen/Library/Developer/Xamarin/android-ndk directory.

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.

Visual Studio for Mac Preview
Download the Visual Studio for Mac Preview v7.0.0 archive to any directory on your disk, double-click it and then drag and drop the Visual Studio for Mac Preview icon to the Applications folder.

Xamarin.Android
Download the Xamarin.Android v7.1.0 archive to any directory on your disk, double-click it and follow the instructions on screen. Please accept all the defaults during the installation, including the target drive.

Xamarin.iOS
Download the Xamarin.iOS v10.4.0 archive to any directory on your disk, double-click it and follow the instructions on screen. Please accept all the defaults during the installation, including the target drive.

Xamarin.Mac
Download the Xamarin.Mac v3.0.0 archive to any directory on your disk, double-click it and follow the instructions on screen. Please accept all the defaults during the installation, including the target drive.
出現這樣的錯誤,解決辦法就是按照提示內容,將所需要下載的模塊下載下來單獨安裝就好了,在這裏有兩個地方是需要注意的,是關於Android SDK和Android NDK的放置問題,其他的只要下載下dmg文件直接單獨安裝就可以,重點說一下Android SDK和Android NDK。

首先Android SDK 下載完成後,我這裏是這樣一個壓縮包:android-sdk_r24.4.1-macosx.zip 直接解壓,將解壓后里面的內容放到上面橙色的提示的文件路徑下:

/Users/allen/Library/Developer/Xamarin/android-sdk-macosx

可以看到此處兩個文件目錄是不一樣的,在下載的包中缺少了platform-tools文件夾,由於我們是需要手動配置Android SDK的位置,需要打開VS for Mac ,當我直接使用下載的包解壓後的文件的時候,配置的sdk會提示無法在此位置找到SDK,猜測應該是platform-tools文件,此時可以運行tools文件裏的android程序,進行下載sdk,可以不需要全部下載完成,在安裝錯誤的提示內容中“

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.
”是這樣寫的,當然這句話的主要意思還是,你可能需要很多的模擬器鏡像,可以進行安裝,但這個操作任何時候都可以,所以這個地方,你可以先運行android,只安裝一部分,我猜測應該是只要有了platform-tools文件就可以了,這個時候再配置s d k路徑,就會提示在指定位置找到了SDK 了。

另外下面Java SDK(JDK)這個直接下載安裝即可。

最有點折騰了就是這個Android NDK ,這個下載後是一個bin包,android-ndk-r10e-darwin-x86_64.bin,下載完後需要解壓,解壓並不是直接打開的方式解壓,而是通過命令行解壓,命令如下:

1、獲取文件權限:

chmod a+x android-ndk-r10e-darwin-x86_64.bin    注意這時文件位於系統的根路徑,執行完成後,執行下一條命令:

2、解壓文件

./android-ndk-r10e-darwin-x86_64.bin     解壓完成後是一個:android-ndk-r10e文件,將這個文件拷貝到:

/Users/allen/Library/Developer/Xamarin/android-ndk。目錄下,如圖:

   

然後在VS中配置NDK的位置:/Users/allen/Library/Developer/Xamarin/android-ndk/android-ndk-r10e    

至此,大功告成。另外如果是IOS的開發,則需要安裝Xcode,安裝完成後,Apple SDK位置會自動配置完成。關於Android的各個系統版本的模擬器,需要自己運行Android SDK Manager 下載了。

這一篇博客只記錄這些內容,這周要開始繼續之前的.Net Core了,最近工作一直忙,電腦也加上報廢了,浪費了好多時間,晚上繼續還得安裝Windows環境,實在是痛苦至極!!!



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章