「Apache Cordova」:修訂間差異
跳至導覽
跳至搜尋
第25行: | 第25行: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
npm install -g cordova | npm install -g cordova | ||
</syntaxhighlight> | |||
=== Gradle === | |||
在Android環境中會需要[[Gradle]]: | |||
<syntaxhighlight lang="bash"> | |||
sudo apt install -y gradle; sudo apt clean | |||
</syntaxhighlight> | </syntaxhighlight> | ||
於 2024年10月29日 (二) 15:52 的修訂
Apache Cordova是一套應用程式開發框架。
安裝
這邊提到的是Ubuntu下的安裝,包括了相依性的Android Studio與Cordova。
Android Studio
先安裝Android Studio最新版:
sudo add-apt-repository -y https://launchpad.net/~maarten-fonville/+archive/ubuntu/android-studio
sudo apt install -y android-studio-4.2
然後:
- 打開Android Studio的SDK Manager,安裝22與29版。
- 另外打開AVD Manager建立一個ARM的模擬器(用在需要同時跑VirtualBox的時候,因為無法在VirtualBox啟動時使用需要KVM的x86模擬器,這時後可以用這個方法避開)。
Cordova
npm install -g cordova
Gradle
在Android環境中會需要Gradle:
sudo apt install -y gradle; sudo apt clean
使用
先建立hello這個專案:
cordova create hello
增加Android環境:
cordova platform add android
跑起來,其中--target可以不加,系統會選一個預設值用:
cordova run android --target="Pixel_2_API_22"
外部連結
- 官方網站 (英文)