[KMP] 如何建立專案 #2

環境建立

開發工具

  • Android Studio
  • Xcode

其他工具

  • Homebrew

Kdoctor

kdoctor 是一個 Kotlin Multiplatform (KMP) 開發環境診斷工具,它可以幫助你檢查系統是否已正確安裝並配置開發 KMP 所需的各種工具和依賴。

如何安裝 kdoctor

因為我是使用 mac 開發,這裡只說明 mac 的環境~

brew install kdoctor

Terminal

kdoctor

終端機直接輸入就能檢測

GitHub - Kotlin/kdoctor: Environment analysis tool
Environment analysis tool. Contribute to Kotlin/kdoctor development by creating an account on GitHub.

kdoctor github

透過這個工具可以快速檢查電腦環境是否有符合 KMP 的開發要求


Creat Project

目前建立專案的方式有兩種,一種是透過網頁 Kotlin Multiplatform Wizard 的方式,它會讓你設定專案名稱與選擇平台(如下圖),最後會直接下載一個預設專案檔。

KMP 建立專案精靈

第二種方式是透過 IDE Plugin,可以直接開啟 AndroidStudio 來建立專案。

IDE KMP Plugin
Kotlin Multiplatform - IntelliJ IDEs Plugin | Marketplace
The Kotlin Multiplatform plugin helps you develop applications that work on both Android and iOS. With the Kotlin Multiplatform plugin for Android Studio, you can…

KMP Create Project Plugin